VS Code keyboard shortcuts
VS Code is designed to be driven from the keyboard. Two shortcuts unlock everything else: the Command Palette (Ctrl+Shift+P) finds any command by name and shows its key binding, and Quick Open (Ctrl+P) jumps to any file. Multi-cursor editing is where the real speed gains live.
Practise VS Code shortcuts
42 VS Code shortcuts for Windows. You get 10 prompts: press the real keys on your keyboard (or pick from four answers on a phone). Anything you miss comes back sooner in your daily review.
VS Code shortcut cheat sheet
General
| Action | Windows | Mac |
|---|---|---|
| Command Palette | CtrlShiftP | ⌘cmd⇧shiftP |
| Quick Open file | CtrlP | ⌘cmdP |
| Open settings | Ctrl, | ⌘cmd, |
| Keyboard Shortcuts editor | CtrlKCtrlS | ⌘cmdK⌘cmdS |
| Toggle sidebar | CtrlB | ⌘cmdB |
| Toggle integrated terminal | Ctrl` | ⌃control` |
| Zen mode | CtrlKZ | ⌘cmdKZ |
Editing
| Action | Windows | Mac |
|---|---|---|
| Toggle line comment | Ctrl/ | ⌘cmd/ |
| Toggle block comment | ShiftAltA | ⇧shift⌥optionA |
| Format documentCtrl+Shift+I on Linux | ShiftAltF | ⇧shift⌥optionF |
| Move line up or down | Alt↑ | ⌥option↑ |
| Copy line down | ShiftAlt↓ | ⇧shift⌥option↓ |
| Delete line | CtrlShiftK | ⌘cmd⇧shiftK |
| Insert line below | CtrlEnter | ⌘cmd↩return |
| Indent or outdent lineCtrl+[ outdents | Ctrl] | ⌘cmd] |
Multi-cursor
| Action | Windows | Mac |
|---|---|---|
| Add next match to selection | CtrlD | ⌘cmdD |
| Select all matches | CtrlShiftL | ⌘cmd⇧shiftL |
| Add cursor above or below | CtrlAlt↓ | ⌥option⌘cmd↓ |
| Add cursor at click | AltClick | ⌥optionClick |
| Cursor at end of each selected line | ShiftAltI | ⇧shift⌥optionI |
| Expand selection | ShiftAlt→ | ⌃control⇧shift⌘cmd→ |
Navigation
| Action | Windows | Mac |
|---|---|---|
| Go to line | CtrlG | ⌃controlG |
| Go to symbol in file | CtrlShiftO | ⌘cmd⇧shiftO |
| Go to definition | F12 | F12 |
| Peek definition | AltF12 | ⌥optionF12 |
| Go back | Alt← | ⌃control- |
| Jump to matching bracket | CtrlShift\ | ⇧shift⌘cmd\ |
| Show problems panel | CtrlShiftM | ⌘cmd⇧shiftM |
Search & refactor
| Action | Windows | Mac |
|---|---|---|
| Find | CtrlF | ⌘cmdF |
| Replace | CtrlH | ⌥option⌘cmdF |
| Search across files | CtrlShiftF | ⌘cmd⇧shiftF |
| Rename symbol | F2 | F2 |
| Quick Fix | Ctrl. | ⌘cmd. |
| Trigger suggestion | CtrlSpace | ⌃controlSpace |
Editor groups
| Action | Windows | Mac |
|---|---|---|
| Split editor | Ctrl\ | ⌘cmd\ |
| Close editor | CtrlW | ⌘cmdW |
| Reopen closed editor | CtrlShiftT | ⌘cmd⇧shiftT |
| Toggle word wrap | AltZ | ⌥optionZ |
Debug
| Action | Windows | Mac |
|---|---|---|
| Start or continue debugging | F5 | F5 |
| Toggle breakpoint | F9 | F9 |
| Step over | F10 | F10 |
| Step into | F11 | F11 |
Source: VS Code Docs: Default keyboard shortcuts; VS Code keyboard shortcut reference PDFs (Windows, macOS, Linux). Defaults for the current version as documented by Microsoft; custom keymaps and non-US keyboard layouts can differ.
Can't find it? Ask about VS Code
Type a task in plain words and get the shortcut for Windows, with a note if the app lacks one.
Quick answers
VS Code shortcut questions
How do I comment out multiple lines in VS Code?
Select the lines and press Ctrl+/ on Windows and Linux or Cmd+/ on a Mac to toggle line comments. Shift+Alt+A (Shift+Option+A) toggles a block comment.
What is the VS Code format shortcut?
Shift+Alt+F on Windows, Shift+Option+F on a Mac and Ctrl+Shift+I on Linux format the whole document using the configured formatter.
Also practise: Windows · Mac · Excel · Word · PowerPoint