elefcode
← 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

More cheat sheets