Make and Extend Selection Using Keyboard

Use the keyboard to select blocks of code then extend/shrink the selection.

In coding, we select code and operate on it. For example, move it to another line, change its indentation, etc.

You can use your mouse to make your selection. Or, use the keyboard.

For example, use Move Caret to Previous Word with Selection ⌥⇧← (macOS) / Ctrl+Shift+Left Arrow (Windows/Linux) to (a) move the cursor forward or backward a word, while (b) expanding the selection along the way. Want to select three words? Do it three times.

In Python code you frequently want to gradually expand a selection from where the cursor is at: the symbol, then the substatement, then the full statement, then the line, then the block, etc. ⌥↑ (macOS) / Ctrl+W (Windows/Linux) is ideal. It works semantically. Keep pressing it until you get the selection you want. Go too far? Do the inverse to shrink the selection.

Without using the mouse.

Finally, PyCharm also supports multiselection aka multiple carets.


Related Resources

See VCS Changed Lines In Gutter
Quickly spot which parts of your file have changed since the last commit.
Split Screen Without Tabs
Get your code and tests side-by-side without resorting to tabs.
Run From Keyboard
Use the keyboard to select and run a run configuration.