JetBrains Rider 2019.3 Help

Multiple Carets and Selection Ranges

When typing, copying, or pasting, you can toggle multiple carets so that your actions apply in several places simultaneously. Advanced editor actions, such as code completion and live templates are supported as well and will apply to each caret.

The most recently added caret is considered primary. Highlighting of the current editor line, completion lists, and other visual assistance features will apply to the primary caret. This caret will also remain when you turn off multiple carets.

Placement and behavior of the carets depend on:

Add, remove, and clone carets

Add carets at selected locations

  • Press Shift+Alt and click the left mouse button at the target location of the caret.

Add carets above or below the current caret

  • Press Ctrl twice, and then without releasing it, press up or down arrow keys.

  • Press Ctrl+Shift+A, type Clone caret, and choose the desired action from the suggestion list:

    Clone caret

    Note that by default these actions are not associated with keyboard shortcuts. You can assign your custom shortcuts to these actions as described in configuring keyboard shortcuts.

  • Enable the column selection mode Shift+Alt+Insert and then press Shift+Up/Shift+Down.

Remove multiple carets carets

  • Press Esc to delete all the existing carets, except the one that was added last.

  • Press Shift+Alt and click carets that you want to remove.

Select multiple non-contiguous ranges

When you select multiple text ranges (non-contiguous selection), note the following:

  • Each selection range is associated with its own caret, so you can start typing to replace all selected ranges with your input, or you can press Left Arrow or Right Arrow to remove the selection ranges but keep multiple carets at beginnings/ends of the ranges.

  • As soon as selection ranges overlap, they are merged into a single selection range with a single caret.

  • Selection works independently of the code structure, that is selection ranges can include any characters, identifiers, words in string literals, comments, or their parts. So you have to be careful when changing the selected ranges as they may include different identifiers or their parts.

Select multiple words or text ranges

  1. Press and hold Shift+Alt.

  2. Double-click words you want to select.

  3. Drag the mouse over text ranges you want to select.

    JetBrains Rider: Select multiple text fragments

Select multiple occurrences of a word or a text range

  1. If you want to select words, set your caret at an occurrence of the desired word. Otherwise, select the desired range with the mouse or with keyboard shortcuts.

  2. Do one of the following:

    • Successively press Alt+J to find and select the next occurrence of case-sensitively matching word or text range.

    • Press Ctrl+Shift+Alt+J to select all case-sensitively matching words or text ranges in the document.

  3. To remove selection from the last selected occurrence, press Shift+Alt+J.

  4. After the second or any consecutive selection was added with Alt+J, you can skip it and select the next occurrence with F3. To return the selection to the lastly skipped occurrence, press Shift+F3.

    JetBrains Rider. Select multiple occurrences. skip occurrence

Use mouse to select rectangular fragments of text in normal selection mode

  1. Make sure that the column selection mode is disabled.

  2. To select ranges as a single rectangle, press and hold Alt or the middle mouse button.
    To select multiple rectangles, press and hold Ctrl+Shift+Alt (Windows or UNIX)/ Shift+Alt+Cmd (macOS).

  3. Drag the mouse pointer over desired ranges.

  4. Alternatively, set the caret at one corner of the rectangle, press and hold Shift+Alt, and then click at the diagonally opposite corner.

  5. As a result, you will have multiple selection ranges in each affected document line. On lines that are shorter than the rectangle, the selection will only span to the last character.

    Note that if inlay hints or code vision is enabled, the hint insertions will visually shift selection ranges but they will not be copied.

    Select multiple rectangular fragments of text

Select rectangular fragment using keyboard

  1. Add carets above or below the current caret to affect all lines of the target rectangle.

  2. Press Shift+Left/ Shift+Right to extend the rectangular selection left or right.

  3. If the column selection mode was enabled, the selection could also include empty spaces after ends of lines. These will be replaced with whitespaces in the clipboard if you copy the selection.

    JetBrains Rider Select rectangular fragment using keyboard

Column selection mode

In the column selection mode, keyboard navigation and selection shortcuts work differently to simplify adding multiple carets and making rectangular selections.

Toggle between normal and column selection modes

  • Press Shift+Alt+Insert.

  • From the main menu, choose Edit | Column Selection Mode.

  • From the context menu of the editor, choose Column Selection Mode.

The following will change in the column selection mode:

  • You will be able to set your caret anywhere after the last character in each line. As soon as you start typing at a position beyond the end of the line, the necessary number of spaces will be added between the end of the line and the beginning of your input.

  • Pressing Shift+Up/Shift+Down will add a new caret above/below the current one instead of making a continuous selection.

  • The enabled column selection mode only affects the current editor tab. If you close or reopen the tab, it will switch back to the normal mode.

Copy and paste with multiple carets

When text ranges selected with multiple carets are copied Ctrl+C or cut Ctrl+X, selections for each caret are placed to the clipboard as separate lines, even if the original selections were on the same line.

If the column selection mode was enabled, the selection could also include empty spaces after ends of lines. These will be replaced with whitespaces in the clipboard if you copy the selection.

When you paste any multi-line content from the clipboard, you can add multiple carets for each line in desired places, and then press Ctrl+V to paste each line at its own caret.

Last modified: 24 February 2020