VS Code Keyboard Shortcuts Guide
Short answer: the most useful VS Code shortcut is the Command Palette (Ctrl+Shift+P, or Cmd+Shift+P on macOS), because it finds every command. Learn it first, then add the shortcuts below for the actions you repeat most.
Navigation
| Action | Windows / Linux | macOS |
|---|---|---|
| Command Palette | Ctrl+Shift+P | Cmd+Shift+P |
| Quick open file | Ctrl+P | Cmd+P |
| Go to line | Ctrl+G | Ctrl+G |
| Go to symbol in file | Ctrl+Shift+O | Cmd+Shift+O |
| Go to definition | F12 | F12 |
| Peek definition | Alt+F12 | Option+F12 |
| Toggle sidebar | Ctrl+B | Cmd+B |
| Toggle terminal | Ctrl+` | Ctrl+` |
Editing lines
| Action | Windows / Linux | macOS |
|---|---|---|
| Move line up or down | Alt+Up/Down | Option+Up/Down |
| Copy line down | Shift+Alt+Down | Shift+Option+Down |
| Delete line | Ctrl+Shift+K | Cmd+Shift+K |
| Toggle line comment | Ctrl+/ | Cmd+/ |
| Format document | Shift+Alt+F | Shift+Option+F |
| Indent / outdent | Ctrl+] / Ctrl+[ | Cmd+] / Cmd+[ |
Multi-cursor and selection
Editing many places at once is the biggest time saver.
| Action | Windows / Linux | macOS |
|---|---|---|
| Select next occurrence of the word | Ctrl+D | Cmd+D |
| Select all occurrences | Ctrl+Shift+L | Cmd+Shift+L |
| Add cursor at click | Alt+Click | Option+Click |
| Add cursor above / below | Ctrl+Alt+Up/Down | Cmd+Option+Up/Down |
| Expand selection | Shift+Alt+Right | Ctrl+Shift+Cmd+Right |
Example: place the cursor on a variable, press Ctrl+D three times to select three uses, and type the new name once.
Search and refactoring
| Action | Windows / Linux | macOS |
|---|---|---|
| Find in file | Ctrl+F | Cmd+F |
| Replace in file | Ctrl+H | Cmd+Option+F |
| Search across project | Ctrl+Shift+F | Cmd+Shift+F |
| Rename symbol | F2 | F2 |
| Quick fix | Ctrl+. | Cmd+. |
| Trigger suggestions | Ctrl+Space | Ctrl+Space |
Windows and layout
- Split the editor: Ctrl+\ (Cmd+\ on macOS).
- Close the current tab: Ctrl+W.
- Switch between open tabs: Ctrl+Tab.
- Zen mode (distraction-free): Ctrl+K Z.
Debugging
- F5 start or continue, F9 toggle breakpoint.
- F10 step over, F11 step into, Shift+F11 step out.
Full walkthrough: how to debug code in VS Code.
Customize your keys
Open the shortcut editor with Ctrl+K Ctrl+S, search a command and click the pencil icon to assign a new key. For advanced rules, edit keybindings.json:
[
{ "key": "ctrl+alt+t", "command": "workbench.action.terminal.toggleTerminal" }
]
How to learn them without overload
- Pick three shortcuts for actions you do every day.
- Use them for a week until they feel automatic.
- Add three more.
A printable summary is in the VS Code cheat sheet. Also see settings and customization.
Frequently asked questions
How do I see all keyboard shortcuts in VS Code?
Open the Keyboard Shortcuts editor with Ctrl+K Ctrl+S (Cmd+K Cmd+S on macOS). You can search every command, see its binding and change it.
Can I use Vim or Sublime Text shortcuts in VS Code?
Yes. Extensions such as Vim and Sublime Text Keymap bring familiar bindings, so you can keep your muscle memory while using VS Code features.
How can I remember so many shortcuts?
Learn two or three at a time, starting with the Command Palette, quick open and multi-cursor. Repeat them in real work for a week before adding more, and print a cheat sheet if it helps.
Why does a shortcut not work for me?
Another application, your operating system or a VS Code extension may use the same keys. Check the Keyboard Shortcuts editor for conflicts and, on some keyboard layouts, remap the binding.
