Cheat sheetDev

VS Code shortcuts

The VS Code keyboard shortcuts that actually change how fast you work — editing, navigation and multi-cursor — for Windows and macOS side by side.

Last updated

The big three

ActionWindows / LinuxmacOS
Command palette (every command lives here)Ctrl+Shift+PCmd+Shift+P
Go to file by nameCtrl+PCmd+P
Toggle integrated terminalCtrl+`Ctrl+` (not Cmd)

Editing

ActionWindows / LinuxmacOS
Move line up / downAlt+↑ / Alt+↓Opt+↑ / Opt+↓
Copy line up / downShift+Alt+↑ / ↓Shift+Opt+↑ / ↓
Delete whole lineCtrl+Shift+KCmd+Shift+K
Toggle line commentCtrl+/Cmd+/
Rename symbol everywhereF2F2
Format documentShift+Alt+FShift+Opt+F
Quick fix / code actionCtrl+.Cmd+.

Multi-cursor & selection

ActionWindows / LinuxmacOS
Select next occurrence of selectionCtrl+DCmd+D
Select ALL occurrencesCtrl+Shift+LCmd+Shift+L
Add cursor above / belowCtrl+Alt+↑ / ↓Cmd+Opt+↑ / ↓
Add cursor by clickingAlt+ClickOpt+Click
Expand selection by scopeShift+Alt+→Ctrl+Shift+→

Navigation

ActionWindows / LinuxmacOS
Go to definitionF12F12
Peek definition inlineAlt+F12Opt+F12
Find all referencesShift+F12Shift+F12
Go to line numberCtrl+GCtrl+G
Go to symbol in fileCtrl+Shift+OCmd+Shift+O
Go back / forwardAlt+← / Alt+→Ctrl+- / Ctrl+Shift+-

Search & files

ActionWindows / LinuxmacOS
Search across the whole projectCtrl+Shift+FCmd+Shift+F
Replace in fileCtrl+HOpt+Cmd+F
Split editorCtrl+\Cmd+\
Reopen closed editorCtrl+Shift+TCmd+Shift+T

Worth remembering

  • →If you memorise nothing else: Ctrl/Cmd+Shift+P reaches every command in the editor by typing its name — the rest of this sheet is shortcuts for what you do hourly.
  • →Ctrl/Cmd+D then repeated presses is the gateway to multi-cursor editing: select a word, press again for the next occurrence, edit them all at once.

Questions

Which one is worth learning first?

The command palette. Everything else is discoverable through it, including the keybinding for whatever you just ran — so it teaches you the other shortcuts as a side effect.

How do I add a cursor at every occurrence?

Select the word and press the add-selection shortcut repeatedly for one at a time, or the select-all-occurrences one for every instance at once. The second is faster and worth checking before you type.

What is the difference between the two search boxes?

Quick open jumps to a file by name; search looks inside files for text. Reaching for the wrong one is the most common reason a search seems to find nothing.

Do these work in other editors?

Many do, since a lot of them originate in earlier editors. VS Code also ships keymap extensions for Vim, IntelliJ and Sublime, which is worth installing rather than relearning muscle memory.

How do I change a shortcut I keep mistyping?

Open the keyboard shortcuts editor, search for the command, and rebind it. Conflicts are shown there too, which is usually the explanation when a documented shortcut appears to do nothing.

Why does a shortcut behave differently in the terminal panel?

Because the integrated terminal claims most key combinations for the shell running inside it. VS Code exposes which chords it keeps, and anything else is passed through — which is why a familiar editor shortcut can produce a control character instead.

What is the fastest way to move a line or block?

The move-line-up and move-line-down commands, which take the current line or the whole selection with them and reindent as they go. It replaces cut, click, paste, and it is the shortcut most people are surprised exists.

Related in Cheat sheets