VS Code Keyboard Shortcuts
Code faster — the VS Code shortcuts worth memorising, Mac and Windows side by side.
| Action | Mac | Windows | |
|---|---|---|---|
| Command Palette | ⌘⇧P | Ctrl+Shift+P | |
| Quick Open file | ⌘P | Ctrl+P | |
| Toggle terminal | ⌃` | Ctrl+` | |
| Toggle sidebar | ⌘B | Ctrl+B | |
| Comment line | ⌘/ | Ctrl+/ | |
| Move line up / down | ⌥↑ / ↓ | Alt+↑ / ↓ | |
| Copy line up / down | ⇧⌥↑ / ↓ | Shift+Alt+↑ / ↓ | |
| Add cursor above / below | ⌘⌥↑ / ↓ | Ctrl+Alt+↑ / ↓ | |
| Select next occurrence | ⌘D | Ctrl+D | |
| Rename symbol | F2 | F2 | |
| Go to definition | F12 | F12 | |
| Format document | ⇧⌥F | Shift+Alt+F | |
| Find / replace | ⌘F / ⌘⌥F | Ctrl+F / Ctrl+H | |
| Multi-cursor at click | ⌥Click | Alt+Click |
The two shortcuts that define VS Code
⌘/Ctrl + Shift + P opens the Command Palette — every command in the editor is one search away, so you rarely need to remember any other shortcut. ⌘/Ctrl + D selects the next occurrence of the current word; press it repeatedly to edit every match at once with multiple cursors.
Move and duplicate lines
Alt+↑/↓ moves the current line (or selection) without cut-and-paste, and Shift+Alt+↓ duplicates it below. On the Mac swap Alt for ⌥.
FAQ
How do I open the Command Palette in VS Code?
Press Ctrl+Shift+P on Windows/Linux or ⌘⇧P on the Mac. Type any command name to run it — this is the fastest way to discover shortcuts.
What is the multi-cursor shortcut in VS Code?
Ctrl+D (⌘D on Mac) selects the next occurrence of the current selection, adding a cursor each time. Alt+Click places a cursor anywhere.
Can I change VS Code shortcuts?
Yes — open Keyboard Shortcuts with Ctrl+K Ctrl+S (⌘K ⌘S on Mac) and rebind any command. This page lists the defaults.