Skip to main content

92 shortcuts · Windows and Mac

VS Code Keyboard Shortcuts

Updated

Visual Studio Code ships with hundreds of default keybindings, and a handful of them account for most of the speed difference between a fast editor user and a slow one. This sheet covers the defaults as installed: the command palette, multi-cursor editing, find and replace, code navigation, editor layout and the debugger. If you have imported a Vim, Sublime or IntelliJ keymap, your bindings will differ — check Keyboard Shortcuts to see what is actually bound.

Platforms covered: Windows and macOS, using the default keybindings that ship with Visual Studio Code — nothing here depends on an extension or a customised keymap.

General

VS Code keyboard shortcuts — General. Windows keys, Mac keys and what each one does.
WindowsMacAction
CtrlShiftPCmdShiftPShow the Command Palette
CtrlPCmdPQuick Open — go to a file by name
CtrlNCmdNNew file
CtrlOCmdOOpen a file
CtrlSCmdSSave
CtrlShiftSCmdShiftSSave As
CtrlWCmdWClose the editor
CtrlShiftNCmdShiftNOpen a new window
CtrlShiftWCmdShiftWClose the window
Ctrl,Cmd,Open Settings
CtrlKthenCtrlSCmdKthenCmdSOpen Keyboard Shortcuts
CtrlKthenCtrlTCmdKthenCmdTChange the colour theme

Basic editing

VS Code keyboard shortcuts — Basic editing. Windows keys, Mac keys and what each one does.
WindowsMacAction
CtrlXCmdXCut the whole line when nothing is selected
CtrlCCmdCCopy the whole line when nothing is selected
AltDown arrowOptionDown arrowMove the line down
AltUp arrowOptionUp arrowMove the line up
ShiftAltDown arrowShiftOptionDown arrowCopy the line down
ShiftAltUp arrowShiftOptionUp arrowCopy the line up
CtrlShiftKCmdShiftKDelete the line
CtrlEnterCmdEnterInsert a new line below
CtrlShiftEnterCmdShiftEnterInsert a new line above
Ctrl]Cmd]Indent the line
Ctrl[Cmd[Outdent the line
Ctrl/Cmd/Toggle a line comment
ShiftAltAShiftOptionAToggle a block comment
AltZOptionZToggle word wrap

Multi-cursor and selection

VS Code keyboard shortcuts — Multi-cursor and selection. Windows keys, Mac keys and what each one does.
WindowsMacAction
CtrlACmdASelect everything in the file
CtrlLCmdLSelect the current line
CtrlDCmdDAdd the next match of the selection to the cursors
CtrlKthenCtrlDCmdKthenCmdDSkip this match and move to the next one
CtrlUCmdUUndo the last cursor operation
CtrlF2CmdF2Select every occurrence of the current word
CtrlAltDown arrowOptionCmdDown arrowAdd a cursor on the line below
CtrlAltUp arrowOptionCmdUp arrowAdd a cursor on the line above
ShiftAltIShiftOptionIAdd a cursor at the end of every selected line
AltClickOptionClickAdd a cursor wherever you click
ShiftAltRight arrowCtrlShiftCmdRight arrowExpand the selection to the next syntax level
ShiftAltLeft arrowCtrlShiftCmdLeft arrowShrink the selection back
CtrlShiftBackslashCmdShiftBackslashJump to the matching bracket

Search and replace

VS Code keyboard shortcuts — Search and replace. Windows keys, Mac keys and what each one does.
WindowsMacAction
CtrlFCmdFFind in this file
CtrlHOptionCmdFReplace in this file
F3CmdGFind the next match
ShiftF3CmdShiftGFind the previous match
AltEnterOptionEnterSelect every match of the current search
CtrlShiftFCmdShiftFSearch across every file in the folder
CtrlShiftHCmdShiftHReplace across every file in the folder
CtrlShiftJCmdShiftJShow the search filters and options
AltCOptionCmdCToggle case-sensitive matching
AltWOptionCmdWToggle whole-word matching
AltROptionCmdRToggle regular-expression matching
VS Code keyboard shortcuts — Navigating code. Windows keys, Mac keys and what each one does.
WindowsMacAction
F12F12Go to the definition
AltF12OptionF12Peek the definition without leaving the file
ShiftF12ShiftF12Show every reference to the symbol
F2F2Rename the symbol everywhere
CtrlTCmdTSearch every symbol in the project
CtrlShiftOCmdShiftOGo to a symbol in this file
CtrlGCtrlGGo to a line number
AltLeft arrowCtrlMinusGo back to where you were
AltRight arrowCtrlShiftMinusGo forward again
CtrlHomeCmdUp arrowJump to the start of the file
CtrlEndCmdDown arrowJump to the end of the file
CtrlShiftMCmdShiftMOpen the Problems panel
F8F8Go to the next error or warning
ShiftF8ShiftF8Go to the previous error or warning

Editor layout and panels

VS Code keyboard shortcuts — Editor layout and panels. Windows keys, Mac keys and what each one does.
WindowsMacAction
CtrlBackslashCmdBackslashSplit the editor
Ctrl1Cmd1Focus the first editor group
Ctrl2Cmd2Focus the second editor group
CtrlKthenCtrlLeft arrowCmdKthenCmdLeft arrowFocus the previous editor group
CtrlKthenCtrlRight arrowCmdKthenCmdRight arrowFocus the next editor group
CtrlBCmdBShow or hide the side bar
CtrlJCmdJShow or hide the bottom panel
CtrlBackquoteCtrlBackquoteShow or hide the integrated terminal
CtrlShiftECmdShiftEOpen the Explorer
CtrlShiftGCtrlShiftGOpen Source Control
CtrlShiftDCmdShiftDOpen the Run and Debug view
CtrlShiftXCmdShiftXOpen Extensions
CtrlShiftUCmdShiftUOpen the Output panel
F11CtrlCmdFToggle full screen

Language tools and debugging

VS Code keyboard shortcuts — Language tools and debugging. Windows keys, Mac keys and what each one does.
WindowsMacAction
CtrlSpaceCtrlSpaceTrigger the suggestion list
CtrlShiftSpaceCmdShiftSpaceShow parameter hints
Ctrl.Cmd.Show Quick Fixes for the problem under the cursor
ShiftAltFShiftOptionFFormat the whole document
CtrlKthenCtrlFCmdKthenCmdFFormat just the selection
CtrlKthenCtrlICmdKthenCmdIShow the hover documentation
CtrlKthenCtrlXCmdKthenCmdXTrim trailing whitespace
CtrlKthenMCmdKthenMChange the language mode of the file
F9F9Toggle a breakpoint on this line
F5F5Start debugging, or continue
F10F10Step over
F11F11Step into
ShiftF11ShiftF11Step out
ShiftF5ShiftF5Stop debugging

VS Code shortcuts — common questions

Are these the shortcuts VS Code ships with?
Yes. Every row is a default keybinding in a fresh Visual Studio Code install, with no extensions and no imported keymap. If you have installed a Vim, Sublime Text or IntelliJ keymap extension, it rebinds large parts of the editor — open Keyboard Shortcuts to see what is actually bound on your machine.
How do I see and change my own keybindings?
Press Ctrl + K then Ctrl + S on Windows, or Cmd + K then Cmd + S on a Mac. That opens the Keyboard Shortcuts editor, where you can search by command or by key, and double-click any row to rebind it. The same list is available from the Command Palette by searching for "Open Keyboard Shortcuts".
What is the single most useful VS Code shortcut?
The Command Palette — Ctrl + Shift + P, or Cmd + Shift + P on a Mac. Every command in the editor is reachable from it by typing a few letters of its name, and it shows you the keyboard shortcut for each one, so it doubles as a way to learn the rest of this list.
Do the shortcuts work the same in VS Code for the Web?
Mostly. vscode.dev runs the same editor, so the editing and navigation shortcuts behave identically. The exceptions are combinations the browser reserves for itself — Ctrl + N, Ctrl + W and Ctrl + Shift + N among them — which the browser handles before the editor ever sees them.