Visual Studio Code: Select each occurrence of find

Keyboard ShortcutsVisual Studio-Code

Keyboard Shortcuts Problem Overview


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.

Keyboard Shortcuts Solutions


Solution 1 - Keyboard Shortcuts

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.

Solution 2 - Keyboard Shortcuts

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.

Solution 3 - Keyboard Shortcuts

I know this thread is here for a while now, but I think this will be helpful:

This thread on Github talks exactly about it:

https://github.com/microsoft/vscode/pull/5715

Summary:

  • Ctrl+F --> Open find widegt.

  • Alt+R --> Turn on regex mode.

  • Input search text --> Regex text or normal text.

  • Alt+Enter --> Select all matches.

  • Left arrow --> Ajust cursors.(Ignore this step if you don't want to edit the ---selected text.)

  • Edit text --> Do what you want.(Ignore this step if you don't want to edit the -selected text.)

  • Shift+Home --> Select modified text.(Ignore this step if you don't want to edit the selected text.)

  • Ctrl+C --> Copy selected text.

  • Ctrl+N --> Open a new tab.

  • Ctrl+V --> Paste.

Solution 4 - Keyboard Shortcuts

well , basically the Ctrl+Shift+L will select all occurrences of word in the document
BUT there is some coool way to selecting them growingly:
if you hit Ctrl+d it will selects the second match , it you hit Ctrl+d again it will match the third one and so on ....

Solution 5 - Keyboard Shortcuts

For Mach User:

COMMAND + Shift + L Select all occurrences of the current selection

COMMAND + F2 Select all occurrences of the current word

Solution 6 - Keyboard Shortcuts

For mac users::

Control + Command + G

^ + + G

Solution 7 - Keyboard Shortcuts

Ctrl+F2 is what worked for me for VSCode on Windows 10.

While Ctrl+Shift+L just opened some Language selector.

Solution 8 - Keyboard Shortcuts

If you are searching in a single file, use simple search using Ctrl+F, then even if you close the search box, simply keep pressing F3 to go to next match and so on. F3 just repeats previous search and selects your next match.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestiondjbView Question on Stackoverflow
Solution 1 - Keyboard ShortcutsDauren AkilbekovView Answer on Stackoverflow
Solution 2 - Keyboard ShortcutsJon GView Answer on Stackoverflow
Solution 3 - Keyboard ShortcutsRodrigo BorbaView Answer on Stackoverflow
Solution 4 - Keyboard ShortcutsamdevView Answer on Stackoverflow
Solution 5 - Keyboard ShortcutsaccimeesterlinView Answer on Stackoverflow
Solution 6 - Keyboard ShortcutswazView Answer on Stackoverflow
Solution 7 - Keyboard ShortcutsPolarisTLXView Answer on Stackoverflow
Solution 8 - Keyboard ShortcutsAmalView Answer on Stackoverflow