← All cheat sheets

Tools

VS Code Keyboard Shortcuts Cheat Sheet

The shortcuts below are written for Windows and Linux. On macOS, swap Ctrl for Cmd and Alt for Option unless a row says otherwise.

Put it into practice with the matching tool.

Test a regex pattern →

Advertisement

Essentials

Ctrl+Shift+PCommand palette — run any command by name
Ctrl+PGo to file by name
Ctrl+,Open settings
Ctrl+K Ctrl+SOpen the keyboard shortcuts list
Ctrl+`Toggle the integrated terminal
Ctrl+BToggle the sidebar
Ctrl+K ZZen mode — hide everything but the editor

Navigation

Ctrl+GGo to line number
Ctrl+Shift+OGo to a symbol in the current file
Ctrl+TGo to a symbol across the whole project
F12Go to definition
Alt+F12Peek definition without leaving the file
Shift+F12Find all references
Alt+← / Alt+→Navigate back and forward
Ctrl+TabSwitch between open editors

Multi-cursor & selection

Alt+ClickAdd a cursor at the click position
Ctrl+Alt+↑ / ↓Add a cursor on the line above or below
Ctrl+DSelect the next occurrence of the selection
Ctrl+Shift+LSelect every occurrence at once
Ctrl+UUndo the last cursor action
Shift+Alt+dragColumn (box) selection
Ctrl+LSelect the whole line
Shift+Alt+→Expand the selection to the enclosing block

Editing

Alt+↑ / Alt+↓Move the current line up or down
Shift+Alt+↑ / ↓Duplicate the line up or down
Ctrl+Shift+KDelete the line
Ctrl+EnterInsert a line below without splitting
Ctrl+/Toggle a line comment
Shift+Alt+AToggle a block comment
Shift+Alt+FFormat the document
Ctrl+K Ctrl+FFormat just the selection
F2Rename the symbol everywhere
Ctrl+.Quick fix / code actions
Ctrl+SpaceTrigger suggestions

Search & replace

Ctrl+FFind in the current file
Ctrl+HReplace in the current file
Ctrl+Shift+FSearch across all files
Ctrl+Shift+HReplace across all files
Alt+EnterSelect all find matches
Alt+C / Alt+W / Alt+RToggle case-sensitive, whole word, regex
F3 / Shift+F3Next and previous match

Panels & layout

Ctrl+\Split the editor
Ctrl+1 / Ctrl+2Focus editor group one, two, …
Ctrl+WClose the editor
Ctrl+K Ctrl+WClose every editor
Ctrl+Shift+EExplorer
Ctrl+Shift+GSource control
Ctrl+Shift+XExtensions
Ctrl+Shift+MProblems panel
Ctrl+Shift+UOutput panel

Debugging & folding

F5Start or continue debugging
F9Toggle a breakpoint
F10 / F11Step over / step into
Shift+F11Step out
Ctrl+Shift+F5Restart the debug session
Ctrl+Shift+[ / ]Fold / unfold the region
Ctrl+K Ctrl+0Fold everything
Ctrl+K Ctrl+JUnfold everything

VS Code in practice

The three shortcuts that matter most

The Command Palette — Ctrl+Shift+P on Windows and Linux, Cmd+Shift+P on macOS — runs any command by name, so you never need to remember where a menu item lives. Quick Open, Ctrl+P, jumps to any file by typing part of its name; add : and a number to go to a line, or @ to jump to a symbol in the file. Go to Definition, F12, and Peek Definition, Alt+F12, navigate code without losing your place. Learn these three and the rest can be found through the palette.

Multi-cursor editing

Ctrl+D (Cmd+D on macOS) selects the next occurrence of the current word, adding a cursor each time, so you can rename several occurrences at once; Ctrl+Shift+L selects them all. Alt+Click adds cursors anywhere, and Ctrl+Alt+Up or Down (Option+Cmd on macOS) adds cursors on the lines above or below. For renaming a variable across files, F2 (Rename Symbol) is safer than text selection because it understands code.

Moving lines and code

Alt+Up and Alt+Down move the current line or selection; add Shift to copy it instead. Ctrl+/ toggles line comments. Ctrl+Shift+K deletes a line. Ctrl+] and Ctrl+[ indent and outdent. Shift+Alt+F formats the document using the configured formatter, and enabling "Format on Save" makes it automatic. Ctrl+. opens quick fixes and refactorings suggested by the language server.

Customising shortcuts

Open Keyboard Shortcuts with Ctrl+K then Ctrl+S to search, view and rebind any command; the "Record Keys" option finds which command a key combination runs. If you are used to another editor, keymap extensions reproduce shortcuts from Vim, Sublime, IntelliJ and others. Shortcuts differ between operating systems, so when following a tutorial, check the palette for the command name rather than the key combination.

Learning gradually

Learn two or three shortcuts at a time and use them deliberately for a week. The Command Palette shows each command's shortcut next to its name, so using the palette is itself a way to discover them. Help → Keyboard Shortcuts Reference opens an official printable PDF for your platform.

Related guides

More cheat sheets