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
| Action | Windows / Linux | macOS |
|---|---|---|
| Command palette (every command lives here) | Ctrl+Shift+P | Cmd+Shift+P |
| Go to file by name | Ctrl+P | Cmd+P |
| Toggle integrated terminal | Ctrl+` | Ctrl+` (not Cmd) |
Editing
| Action | Windows / Linux | macOS |
|---|---|---|
| Move line up / down | Alt+↑ / Alt+↓ | Opt+↑ / Opt+↓ |
| Copy line up / down | Shift+Alt+↑ / ↓ | Shift+Opt+↑ / ↓ |
| Delete whole line | Ctrl+Shift+K | Cmd+Shift+K |
| Toggle line comment | Ctrl+/ | Cmd+/ |
| Rename symbol everywhere | F2 | F2 |
| Format document | Shift+Alt+F | Shift+Opt+F |
| Quick fix / code action | Ctrl+. | Cmd+. |
Multi-cursor & selection
| Action | Windows / Linux | macOS |
|---|---|---|
| Select next occurrence of selection | Ctrl+D | Cmd+D |
| Select ALL occurrences | Ctrl+Shift+L | Cmd+Shift+L |
| Add cursor above / below | Ctrl+Alt+↑ / ↓ | Cmd+Opt+↑ / ↓ |
| Add cursor by clicking | Alt+Click | Opt+Click |
| Expand selection by scope | Shift+Alt+→ | Ctrl+Shift+→ |
Navigation
| Action | Windows / Linux | macOS |
|---|---|---|
| Go to definition | F12 | F12 |
| Peek definition inline | Alt+F12 | Opt+F12 |
| Find all references | Shift+F12 | Shift+F12 |
| Go to line number | Ctrl+G | Ctrl+G |
| Go to symbol in file | Ctrl+Shift+O | Cmd+Shift+O |
| Go back / forward | Alt+← / Alt+→ | Ctrl+- / Ctrl+Shift+- |
Search & files
| Action | Windows / Linux | macOS |
|---|---|---|
| Search across the whole project | Ctrl+Shift+F | Cmd+Shift+F |
| Replace in file | Ctrl+H | Opt+Cmd+F |
| Split editor | Ctrl+\ | Cmd+\ |
| Reopen closed editor | Ctrl+Shift+T | Cmd+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.