Select all occurrences of selected word in VSCode
What if you want to select just a few?
No problem, first:
- Ctrl+F find the letters by typing them
- ESC to quit searching
(you need to do this even when using Ctrl+Shift+L to select all occurences)
OR
- just select those letters with your mouse or keyboard (Shift+arrows)
Now that the mouse cursor is blinking on your first selection, using a few more Key Bindings (thanks for the ref j08691) you may:
- Ctrl+D select (add) the next occurrence
- Ctrl+K+Ctrl+D skip the current/latest occurrence and add the next occurrence
- Ctrl+U undo the latest cursor operation
According to Key Bindings for Visual Studio Code there's:
Ctrl+Shift+L to select all occurrences of current selection
and
Ctrl+F2 to select all occurrences of current word
You can view the currently active keyboard shortcuts in VS Code in the Command Palette (View -> Command Palette
) or in the Keyboard Shortcuts editor (File > Preferences > Keyboard Shortcuts
).
Select All Occurrences of Find Match editor.action.selectHighlights
.
Ctrl+Shift+L
Cmd+Shift+L or Cmd+Ctrl+G on Mac