Selecting Text in the Editor
The basic way to select a piece of text is to extend the selection with the mouse cursor. IntelliJ IDEA, 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, use multiselection, and 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+A.
To select text with navigation keys, use one of the following shortcuts
- Ctrl+Shift+Left, Ctrl+Shift+Right to select text from the caret position to the beginning/end of the current word.
- Ctrl+Shift+Page Up, Ctrl+Shift+Page Down to select text from the caret position to the top/bottom of the screen.
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 Edit | Extend Selection
- 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:
- Pressing Ctrl+W successively in plain text or comments extends the selection first to the current sentence, then to the current paragraph.
- 12.0+Pressing Ctrl+W successively in a method call that contains vararg arguments, first selects a vararg argument the caret rests at, then the whole group of vararg arguments, and then all arguments in the method call.
To shrink selection in the reverse order (from the outermost container to the word where the caret currently resides), do one of the following
- On the main menu, choose Edit | Shrink Selection
- Press Ctrl+Shift+W.
To select multiple words
and double-click the left mouse button.
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 Shift+Alt+Insert.
To make selection in the column selection mode, do one of the following:
To use smart expression selection
- Place the cursor before or within the expression.
- Choose Refactor | Extract Variable from the main or the context menu, or pressCtrl+Alt+V.
- In the Expressions pop-up menu, select the expression. To do that, click the required expression. Alternatively, use the Up and Down arrow keys to navigate to the expression of interest, and then press Enter to select it.
To toggle sticky selection, do one of the following
- Press Ctrl+Shift+A, in the pop-up frame type sticky, and choose Toggle Sticky Selection from the suggestion list:
- In the Emacs keymap, use keyboard shortcut Ctrl+Space.