PyCharm 2.7.2 Web Help

The basic way to select a piece of text is to extend the selection with the mouse cursor. PyCharm, as a keyboard-centric IDE, suggests to use navigation keys to make selections. You can opt to select pieces of text by lines, or select rectangular fragments in the column mode, extend and shrink the selection, and use sticky selection.

In this section:

To select the entire text in the current editor tab, do one of the following
  • On the main menu, choose Edit | Select All.
  • Press Ctrl+ACtrl+A.
To select text with navigation keys, use one of the following shortcuts
  • Ctrl+Shift+LeftCtrl+Shift+Left, Ctrl+Shift+RightCtrl+Shift+Right to select text from the caret position to the beginning/end of the current word.
  • Ctrl+Shift+PageupCtrl+Shift+Pageup, Ctrl+Shift+PagedownCtrl+Shift+Pagedown to select text from the caret position to the top/bottom of the screen.
1.1+
To extend selection from the word at the caret to the piece of code the caret is contained in, use the following shortcuts
  • Press Ctrl+WCtrl+W to select the word where the caret is currently located.
  • Press Ctrl+WCtrl+W successively to extend selection to the next containing node (for example, an expression, a paired tag, an entire conditional block, a method body, a class, a group of vararg arguments, etc.)

    Note

    While extending selection, keep in mind the following:

    • Pressing Ctrl+WCtrl+W successively in plain text or comments extends the selection first to the current sentence, then to the current paragraph.
    • Pressing Ctrl+WCtrl+W successively inside a list, dictionary, or a list of arguments or parameters, selects an element of the list, then the right or left comma and a neighbouring space (if any), then the contents of the list without parentheses, and finally the enclosing parentheses.
  • Press Ctrl+Shift+WCtrl+Shift+W to shrink selection in the reverse order (from the outermost container to the word where the caret currently resides).

    Tip

    The selection extends or shrinks according to capitalization, if CamelHumps mode is enabled (File | Settings | IDE Settings | Editor | Smart Keys | Use "CamelHumps" words for Windows and Linux,
    PyCharm | Preferences | IDE Settings | Editor | Smart Keys | Use "CamelHumps" words for Mac OS).

    If you want to make selection according to capitalization, using double-click, make sure that the option Honor CamelHumps words... is also turned on (File | Settings | IDE Settings | Editor | Honor CamelHumps words... for Windows and Linux,
    PyCharm | Preferences | IDE Settings | Editor | Honor CamelHumps words... for Mac OS).

To toggle between the line and the column selection modes, do one of the following
  • On the main menu, choose Edit | Column Selection Mode.
  • On the context menu of the editor, choose Column Selection Mode.
  • Press Alt+Shift+InsertAlt+Shift+Insert.
  • Keeping the middle mouse button pressed, drag the mouse.
2.0+
To make selection in the column selection mode
  • Keeping the AltAlt key pressed, drag your mouse pointer to select the desired area.
  • Keeping the middle mouse button pressed, drag your mouse pointer to select the desired area.
To use smart expression selection

When you perform various code refactorings that involve selecting an expression , PyCharm can help you select the expression of interest. This feature is known as smart expression selection.

The procedure for the Introduce Variable refactoring is just an example. The smart expression selection feature, in fact, is available in all the refactorings that start with selecting an expression.

  1. Place the cursor before or within the expression.

    ws_php_storm_introduceVariableJSSmartSelectExpressionStart.png

  2. Choose Refactor | Extract Variable from the main or the context menu, or press Ctrl+Alt+VCtrl+Alt+V.
  3. In the Expressions pop-up menu, select the expression. To do that, click the required expression. Alternatively, use the UpUp and DownDown arrow keys to navigate to the expression of interest, and then press EnterEnter to select it.

    ws_php_storm_introduceVariableJSSmartSelectExpression.png

2.5+
To toggle sticky selection, do one of the following
  • Press Ctrl+Shift+ACtrl+Shift+A, in the pop-up frame type sticky, and choose Toggle Sticky Selection from the suggestion list:

    sticky_selection

  • In the Emacs keymap, use keyboard shortcut Ctrl+SpaceCtrl+Space.

See Also

Procedures:

Reference:

Web Resources: