Are there any trick or extension to select all instances of selected word in visual studio code, to facilitate editing or deleting those instances without search and replace
No problem, first:
OR
Now that the mouse cursor is blinking on your first selection, using a few more Key Bindings (thanks for the ref j08691) you may:
on Mac:
select all matches: Command + Shift + L
but if you just want to select another match up coming next: Command + D
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
).
Ctrl + F2 works for me in Windows 10.
Ctrl + Shift + L starts performance logging
In my MacOS case for some reason Cmd+Shift+L is not working while pressing the short cut on the keyboard (although it work just fine while clicking on this option in menu: Selection -> Select All Occurences). So for me pressing Cmd+FN+F2 did the trick (FN is for enabling "F2" obviously).
Btw, if you forget this shortcut just do right-click on the selection and see "Change All Occurrences" option
If you want to do one by one then this is what you can do:
This will help to select words one by one.