If my cursor is under word foo
in text, is there a keybinding in VS Code that will move the cursor to the next occurrence of the word foo
in the text?
(I had this feature in my previous IDE, IntelliJ IDEA. It was called Find Word at Caret)
Mine is Visual Studio Code and the exact command for this is "Add cursors to line ends". The shortcut key is Alt + Shift + I (Windows) or Command + Shift + l (Mac).
Visual Studio Code v 1.3. Replace functionality can be accessed: In the Search View by expanding the Search textbox. Using Ctrl + Shift + H , from the Edit | Replace in Files menu. Using Replace in Files command in the Command Palette.
To find the word at caret, do the following:
Use Ctrl+F
keyboard shortcut then press Enter
.
To navigate between the occurrences of the word at caret
Press F3
to go to the next occurrence.
Press Shift+F3
to go to the previous occurrence.
Or just Press Ctrl+F3
and Ctrl+Shift+F3
,
You may see/change that shortcuts in the editor by going to the menu under File > Preferences > Keyboard Shortcuts. (Code > Preferences > Keyboard Shortcuts on Mac)
then search for find selection
, see:
See Key Bindings for Visual Studio Code, and Keyboard shortcuts cheat sheet in PDF file format for Linux , macOS, and Windows.
Multiple selections (multi-cursor)
Ctrl+D
selects the word at the cursor, or the next occurrence of the current selection.
Press Ctrl+D
again for Multiple selections or you may just Press F3
to go to the next occurrence. Press Shift+F3
to go to the previous occurrence.
And if you enjoy vim, you may install VSCodeVim extension, which is a Visual Studio Code extension that enables Vim keybindings, and like vim: Press *
to search for the next occurrence.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With