Ahmad Ismail
Ahmad Ismail

Reputation: 13952

VSCode: move cursor to next occurrence of given word for each cursor

I have lines like:

"gg":: go to the top:: of the file
"G":: go to the bott::om of the file
"{":: go to the begi::nning of current paragraph
"}":: go to the end ::of current paragraph
"%":: go to the matc::hing pair of (), [], {}
"50%":: go to line a::t the 50% of the file
":NUM":: go to line ::NUM. :28 jumps to line 28

I have cursor in the beginning of each line. So, it looks like:

|"gg":: go to the top:: of the file
|"G":: go to the bott::om of the file
|"{":: go to the begi::nning of current paragraph
|"}":: go to the end ::of current paragraph
|"%":: go to the matc::hing pair of (), [], {}
|"50%":: go to line a::t the 50% of the file
|":NUM":: go to line ::NUM. :28 jumps to line 28

NOTE: Here I am using | as cursor.

Now, I want to move the cursor before first occurrence of :: for each cursor,so that it looks like:

"gg"|:: go to the top:: of the file
"G"|:: go to the bott::om of the file
"{"|:: go to the begi::nning of current paragraph
"}"|:: go to the end ::of current paragraph
"%"|:: go to the matc::hing pair of (), [], {}
"50%"|:: go to line a::t the 50% of the file
":NUM"|:: go to line ::NUM. :28 jumps to line 28

I tried selecting text. then search in selection (ctrl+f>alt+l). then alt+enter. But the issues is, it selects all occurrence of :: and not the first one.

what can I do?

Upvotes: 0

Views: 193

Answers (1)

rioV8
rioV8

Reputation: 28838

Use the extension Select By

And define a key combo

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

Upvotes: 1

Related Questions