简体   繁体   中英

select next occurence of a word when using multiple cursors

From the bellow screen shot you can see that I have placed multi-cursor one multiple lines.

在此处输入图像描述

I want the next occurrence of " to be selected on each line for each cursor. I know I can use ctrl d for selecting next occurrence. But it only works for single cursor. What is the solution for multi-cursor?

with the extension Select By v0.11.0 and the command moveby.regex you can move multiple cursors based on a regular expression.

The regular expression can be fixed in the keybinding or asked from the user.

For fixed regex use a key binding like:

  {
    "key": "ctrl+f6",  // or any other key combo
    "when": "editorTextFocus",
    "command": "moveby.regex",
    "args": {
      "regex": "\"",
      "properties": ["next", "start"]
    }
  }

To ask for a regex use a key binding like:

  {
    "key": "ctrl+shift+f6",  // or any other key combo
    "when": "editorTextFocus",
    "command": "moveby.regex",
    "args": {
      "ask": true,
      "properties": ["next", "start"]
    }
  }

In the Inputbox enter the regular expression in a non-escaped form. In a JSON files you need to escape the " and \ characters.

In a later version the command selectby.regex will also support multi cursor.

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