Cheat Sheet Library

VS Code Cheat Sheet

Shortcuts for Windows / Linux. On macOS: Ctrl → ⌘, Alt → ⌥ (exceptions noted). Everything is searchable in the Command Palette, and you can change keys with Ctrl + K Ctrl + S.

  • 78 entries
  • 12 sections
  • Updated
  • Click a command to see all its options

78 entries

On this page

The Big Ones #

ShortcutAction
Ctrl + Shift + P or F1Command Palette (every command)
Ctrl + PQuick Open a file by name
Ctrl + ,Settings
Ctrl + K Ctrl + SKeyboard shortcuts
Ctrl + `Toggle terminal (mac: ⌃ `)
Ctrl + Shift + `New terminal
Ctrl + BToggle the sidebar
Ctrl + JToggle the bottom panel
ShortcutAction

Editing Lines #

ShortcutAction
Alt + ↑/↓Move the line up / down
Shift + Alt + ↑/↓Copy the line up / down
Ctrl + Shift + KDelete the line
Ctrl + X (no selection)Cut the whole line
Ctrl + Enter / Ctrl + Shift + EnterInsert a line below / above
Ctrl + /Toggle line comment
Shift + Alt + AToggle block comment
Ctrl + ] / Ctrl + [Indent / outdent
Shift + Alt + FFormat document
Ctrl + K Ctrl + FFormat selection
Alt + ZToggle word wrap

Multi-Cursor & Selection #

ShortcutAction
Alt + ClickAdd a cursor
Ctrl + Alt + ↑/↓Add a cursor above / below (mac: ⌥ ⌘ ↑/↓)
Ctrl + DSelect the next occurrence of the word
Ctrl + K Ctrl + DSkip this occurrence
Ctrl + Shift + LSelect all occurrences
Shift + Alt + ICursor at the end of every selected line
Shift + Alt + dragColumn (box) select
Shift + Alt + →/←Expand / shrink the selection
Ctrl + UUndo the last cursor action
EscBack to one cursor

Code Intelligence #

ShortcutAction
Ctrl + SpaceTrigger suggestions
Ctrl + .Quick fix / refactor (the lightbulb)
F2Rename symbol everywhere
F12Go to definition
Alt + F12Peek definition
Shift + F12Show references
Ctrl + Shift + OGo to a symbol in the file (@)
Ctrl + TGo to a symbol in the workspace (#)
Ctrl + GGo to line (mac: ⌃ G)
Ctrl + Shift + \Jump to the matching bracket
Alt + ←/→Go back / forward (mac: ⌃ - / ⌃ ⇧ -)
F8 / Shift + F8Next / previous problem
Ctrl + Shift + MProblems panel
Ctrl + K Ctrl + IShow hover info

Files, Tabs & Layout #

ShortcutAction
Ctrl + N / Ctrl + SNew file / save
Ctrl + K SSave all
Ctrl + WClose the tab
Ctrl + Shift + TReopen the closed tab
Ctrl + TabSwitch between recent tabs
Ctrl + \Split the editor
Ctrl + 1 / 2 / 3Focus editor group 1 / 2 / 3
Ctrl + K ZZen mode (Esc Esc to exit)
Ctrl + = / Ctrl + -Zoom in / out

Folding #

ShortcutAction
Ctrl + Shift + [ / ]Fold / unfold the region
Ctrl + K Ctrl + 0Fold all
Ctrl + K Ctrl + JUnfold all

Find & Replace #

ShortcutAction
Ctrl + F / Ctrl + HFind / replace in the file
Alt + Enter (in Find)Select all matches as cursors
Alt + C / Alt + W / Alt + RToggle case / whole word / regex

Debugging #

ShortcutAction
F5Start / continue
Shift + F5Stop
Ctrl + Shift + F5Restart
F9Toggle breakpoint
F10 / F11 / Shift + F11Step over / into / out

Emmet (HTML/CSS) #

Type then TabResult
!HTML5 boilerplate
ul>li.item*3<ul> with 3 <li class="item">
div.card>h2+pCard with a heading and paragraph
a[href=#]{Click}Link with text

Command Line (code) #

CommandAction
Open the current folder
Open in the existing window
Open at line 42
Compare two files
Install an extension

Useful Settings (settings.json) #

{
  "editor.formatOnSave": true,
  "files.autoSave": "onFocusChange",
  "editor.minimap.enabled": false,
  "editor.linkedEditing": true,          // rename HTML tag pairs together
  "editor.stickyScroll.enabled": true,
  "explorer.confirmDragAndDrop": false
}