PyCharm supports multiple carets. The majority of the editor actions, such as keyboard navigation or text insertion and deletion, apply to each caret. Live templates and autocompletion are supported as well.
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.
Refer to the section Selecting Text in the Editor for additional information.
Adding, deleting, and cloning carets
To add carets, do one of the following
Press Alt and click the left mouse button at the location of the caret.
Press Ctrl (Windows or Linux)/Alt(macOS) twice, and then without releasing it, press up or down arrow keys.
The new carets are added to the specified locations, according to setting of the Allow placement of caret after end of line checkbox:
To delete carets, do one of the following
Press Esc to delete all the existing carets, except the primary one.
Press Shift+Alt and click the left mouse button on a caret to be deleted.
To clone an existing caret upward or downward, do one of the following:
- Press Ctrl+Shift+A, 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 upwards or downwards:
Copying and pasting
When a text with multiple cursors is copied (Ctrl+C) or cut (Ctrl+X), selections for each caret are placed to the clipboard. On paste (Ctrl+V), text from the clipboard is split into lines.