IntelliJ IDEA supports multiple carets. The majority of the editor actions (such as keyboard navigation, text insertion and deletion, etc.) apply to each caret.
It is possible to add or delete carets; at least one caret always exists in an editor tab.
The most recently added caret is considered primary. Highlighting of an editor line at caret applies to the primary caret only.
Placement and behavior of the carets depend on:
- Enabled or disabled column selection mode.
- Enabled or disabled placement of caret after the end of line.
Adding, deleting, and cloning carets
The new carets are added to the specified locations, according to setting of the Allow placement of caret after end of line check box:
- Press to delete all the existing carets, except the primary one.
- Press and click the left mouse button on a caret to be deleted.
- Press Include non-menu actions. , select the check box
- Type Clone caret, and choose the desired action from the suggestion list:
Note that by default these actions are not bound to the keyboard shortcuts. You can do it yourself, as described in the section Configuring keyboard shortcuts.
The primary caret is propagated strictly upwards or downwards:
Copying and pasting
When a text with multiple cursors is copied ( or or or or , or or or or or or or or ) or cut ( or or or or or or or or or or or or ), selections for each caret are placed to the clipboard. On paste ( or or or or , or or or or or or or or ), text from the clipboard is split into lines.