Skip to main content

Select Next Occurrence in VS Code (Linux)

Press Ctrl + D to select the word under the cursor, and with each further press the next place where it occurs.

What it does

The first press selects the word the cursor is in. Every further press adds the next occurrence of that text to the selection and puts a cursor there, so what you type next changes all selected places at once. It suits renaming a variable in a short block or editing a few similar lines, where a full find and replace would be more than the job needs.

The same shortcut on other platforms

PlatformShortcut
Linuxthis pageCtrl + D
macOS
Windows

More VS Code shortcuts: Editing

  • Select All Occurrences
  • Move Line Up
  • Move Line Down
  • Delete Line
  • Toggle Comment

All 29 VS Code shortcuts for LinuxThe full list has a search and a printable PDF.

Questions

What is the VS Code shortcut for Select Next Occurrence on Linux?

Ctrl+D. Press it to select the word under the cursor, and with each further press the next place where it occurs.

What is the shortcut for Select Next Occurrence in VS Code on macOS and Windows?

On macOS it is ⌘D. On Windows it is Ctrl+D.