Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Code: Select each occurrence of find

I'm looking for a "select each occurrence of" something I'm trying to find. For example a file has a bunch of text that includes "abc", I type ctrl+f and type abc. I can either find the first one or the next one, but I would like to "multi-cursor" each one in the file.

I've already found the feature that lets me highlight text and ctrl+d to get the next that matches the selection, but if there's a hundred of these things - well that gets quite tiresome.

like image 439
djb Avatar asked Mar 14 '16 15:03

djb


People also ask

How do you select occurrences in VSCode?

Ctrl+D selects the word at the cursor, or the next occurrence of the current selection. Tip: You can also add more cursors with Ctrl+Shift+L, which will add a selection at each occurrence of the current selected text.

How do you select all occurrences?

You can use ⌃⌘G (macOS), or Ctrl+Alt+Shift+J to select all matching words in the document rather than selecting one at a time. You can use ⌃⇧G (macOS), or Alt+Shift+J (Windows/Linux) to remove the selection from the last selected occurrence.

How do you select multiple times in VS code?

“select multiple in vs code” Code Answer'sWindows: Ctrl + Alt + Arrow Keys. Linux: Shift + Alt + Arrow Keys. Mac: Opt + Cmd + Arrow Keys.

How do I change all occurrences in VSCode?

You can use the Find control in code or text windows, such as Output windows and Find Results windows, by selecting Edit > Find and Replace or pressing Ctrl+F.


2 Answers

Ctrl+Shift+L Select all occurrences of current selection

editor.action.selectHighlights 

Ctrl+F2 Select all occurrences of current word

editor.action.changeAll 

Please refer for more information here.

like image 150
Dauren Akilbekov Avatar answered Oct 13 '22 01:10

Dauren Akilbekov


Alt+Enter Select all occurrences of find match

editor.action.selectAllMatches 

This has the added benefit of working with Regular Expression searches, since selecting occurrences of a word of a selection cannot leverage the Regex functionality.

like image 26
Jon G Avatar answered Oct 13 '22 01:10

Jon G