简体   繁体   中英

Visual Studio IDE: go to previous match in multi caret/cursor

Consider the following setup:

I have:

Test 1

T|est 2

Test 3

where | is the current cursor position. Application of Shft + Alt + . first highlights Test of Test 2 . Subsequent application of Shft + Alt + . takes one to Test of Test 3 . Is there a way to reverse this direction of movement and go from Test of Test 2 to Test of Test 1 ?

The command Edit.InsertNextMatchingCaret is default mapped to Shft + Alt + . There does not seem to be a command Edit.InsertPreviousMatchingCaret .

See gif below for visual description of the issue:

在此处输入图像描述

Unfortunately, AFAIK, there's no out-of-the-box way to achieve this using keyboard shortcuts. Moving the caret works only in one direction in muti-caret editing. To select the previous match, you may use one of two options:

  • Option 1: Select the match manually using keyboard and mouse:

    Press Ctrl + Alt and then use the mouse to manually select the previous match (eg, double click on the "Test" word in the "Test 1" line).

  • Option 2: If you want to rely on hotkeys only, you may use the following workaround:

    1. Press Shift + Alt + . to select the next match.
    2. Press Shift + Alt + / to move the caret/selection to the following match.
    3. Repeat step #2 until you get to to the desired match.

    Here's a demo:

    在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM