Selecting Text in the Editor
In this section:
- Selecting all text in the active editor tab
- Selecting with navigation keys
- Selecting a variable or a function name
- Alternative ways to select code
- Extending selection
- Shrinking selection
- Toggling between line and column selection modes
- Sticky selection
- Tips and tricks
The basic way to select a piece of text is to extend the selection with the mouse cursor. PhpStorm, as a keyboard-centric IDE, suggests to use navigation keys to make selections.
You can opt to select pieces of text, or select rectangular fragments in the column mode, extend and shrink the selection, use multiselection, and sticky selection.
Selecting all text in the active editor tab
To select the entire text in the current editor tab, do one of the following:
Selecting with navigation keys
To select text from the current caret position to the beginning/end of the current word:
To select text from the caret position to the beginning/end of the current line:
To select text from the current caret position to the top/bottom of the screen:
Selecting a variable or a function name
To select the name of a variable or a function, place the caret inside the required name and double-click it or press Ctrl+W.In the PHP context, you can select and copy variable names both with and without a
$sign. This behavior is configured through the Select variable name without $ sign on double click check box on the Smart Keys page of the Settings dialog (File | Settings | Editor | General | Smart Keys for Windows and Linux or PhpStorm | Preferences | Editor | General | Smart Keys for macOS).
When this check box is selected, only the variable name that follows the
$sign is selected on double click or pressing Ctrl+W. This is helpful if you often need to copy variable names without
$: just double-click and copy the selection.
If you still need a variable name with
$selected, place the cursor before the
$sign and double click it or press Ctrl+W.
Alternative ways to select code
To make selection of a column of text, do one of the following:
To extend selection from the word at caret to the piece of code the caret is contained in, do one of the following:
- On the main menu, choose
- Press Ctrl+W to select the word where the caret is currently located.
- Press Ctrl+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.)
While extending selection, keep in mind that:
To shrink selection in the reverse order (from the outermost container to the word where the caret currently resides), do one of the following:
PhpStorm supports selecting multiple text fragments. So doing, one can select multiple words, lines or rectangles.
To select multiple words, follow these steps
To select multiple fragments of text, follow these steps
- Press Alt
- Drag the mouse pointer
To select multiple rectangular fragments of text, follow these steps
- Press Alt (Windows or UNIX)/ (macOS)
- Drag the mouse pointer
Refer to the section Multicursor for additional information.
Toggling between line and column selection modes
To toggle between the line and the column selection modes, do one of the following: