PyCharm supports multiple carets. The majority of the editor actions, such as keyboard navigation, text insertion and deletion, etc., 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.
Adding, deleting, and cloning carets
- Press Shift+Alt and click the left mouse button at the location of the caret.
- Double-click Ctrl and 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 check box:
- 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.
- Press Ctrl+Shift+ACtrl+Shift+ACtrl+Shift+ACtrl+Shift+ACtrl+Shift+ACtrl+Shift+ACtrl+ICtrl+Shift+AShift ⌘ AShift ⌘ A⌘ 3, 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 Ctrl+InsertCtrl+C or Ctrl+InsertCtrl+C or Ctrl+InsertCtrl+C or Ctrl+InsertCtrl+Insert, Alt+C or Escape, WCtrl+C or Ctrl+InsertCtrl+C or Ctrl+InsertCtrl+C or Ctrl+Insert⌘ C or ⌘ Insert⌘ C or ⌘ Insert⌘ C or ⌘ Insert) or cut (Ctrl+X or Shift+DeleteCtrl+X or Shift+DeleteCtrl+X or Shift+DeleteCtrl+X or Shift+DeleteShift+Delete or Alt+XCtrl+X or Shift+DeleteCtrl+X or Shift+DeleteCtrl+X or Shift+Delete⌘ X or Shift Delete⌘ X or Shift Delete⌘ X or Shift Delete), selections for each caret are placed to the clipboard. On paste (Ctrl+V or Shift+InsertCtrl+V or Shift+InsertCtrl+V or Shift+InsertCtrl+V or Shift+InsertAlt+P, Shift+Insert or Ctrl+YCtrl+V or Shift+InsertCtrl+V or Shift+InsertCtrl+V or Shift+Insert⌘ V or Shift Insert⌘ V or Shift Insert⌘ V or Shift Insert), text from the clipboard is split into lines.