Visual Studio Code keyboard shortcuts

VS Code's default shortcuts cover the whole coding loop: edit and navigate code, search and refactor, manage files and panels, run tasks, debug, and use the built-in chat tools. This reference follows Microsoft's current common default list for a standard US keyboard layout.

Windows, macOS, Linux · 153 shortcuts

Basic editing

Change lines, add cursors, select text, move through a file, and use the everyday editor commands.

ActionWindowsmacOSLinux
Cut the line when there is no selectionCtrlXCmdXCtrlX
Copy the line when there is no selectionCtrlCCmdCCtrlC
PasteCtrlVCmdVCtrlV
Delete the current lineCtrlShiftKCmdShiftKCtrlShiftK
Insert a line belowCtrlEnterCmdEnterCtrlEnter
Insert a line aboveCtrlShiftEnterCmdShiftEnterCtrlShiftEnter
Move the line downAltDownAltDownAltDown
Move the line upAltUpAltUpAltUp
Copy the line downShiftAltDownShiftOptionDownCtrlShiftAltDown
Copy the line upShiftAltUpShiftOptionUpCtrlShiftAltUp
UndoCtrlZCmdZCtrlZ
RedoCtrlYCmdShiftZCtrlY
Add the selection to the next find matchCtrlDCmdDCtrlD
Move the last selection to the next find matchTwo-stroke chord.CtrlKCtrlDCmdKCmdDCtrlKCtrlD
Undo the last cursor operationCtrlUCmdUCtrlU
Insert a cursor at the end of each selected lineShiftAltIShiftOptionIShiftAltI
Select all occurrences of the current selectionCtrlShiftLCmdShiftLCtrlShiftL
Select all occurrences of the current wordCtrlF2CmdF2CtrlF2
Select the current lineCtrlLCmdLCtrlL
Insert a cursor belowCtrlAltDownOptionCmdDownShiftAltDown
Insert a cursor aboveCtrlAltUpOptionCmdUpShiftAltUp
Jump to the matching bracketCtrlShift\ShiftCmd\CtrlShift\
Indent the lineCtrl]Cmd]Ctrl]
Outdent the lineCtrl[Cmd[Ctrl[
Go to the beginning of the lineHomeHomeHome
Go to the end of the lineEndEndEnd
Go to the beginning of the fileCtrlHomeCmdUpCtrlHome
Go to the end of the fileCtrlEndCmdDownCtrlEnd
Scroll one line downCtrlDownCtrlPageDownCtrlDown
Scroll one line upCtrlUpCtrlPageUpCtrlUp
Scroll one page downAltPageDownCmdPageDownAltPageDown
Scroll one page upAltPageUpCmdPageUpAltPageUp
Select allCtrlACmdACtrlA

Rich language editing

Use IntelliSense, formatting, refactoring, comments, folds, and language-aware navigation when a language service is available.

ActionWindowsmacOSLinux
Fold the current regionCtrlShift[OptionCmd[CtrlShift[
Unfold the current regionCtrlShift]OptionCmd]CtrlShift]
Toggle the current foldTwo-stroke chord.CtrlKCtrlLCmdKCmdLCtrlKCtrlL
Fold all subregionsTwo-stroke chord.CtrlKCtrl[CmdKCmd[CtrlKCtrl[
Unfold all subregionsTwo-stroke chord.CtrlKCtrl]CmdKCmd]CtrlKCtrl]
Fold all regionsTwo-stroke chord.CtrlKCtrl0CmdKCmd0CtrlKCtrl0
Unfold all regionsTwo-stroke chord.CtrlKCtrlJCmdKCmdJCtrlKCtrlJ
Add a line commentTwo-stroke chord.CtrlKCtrlCCmdKCmdCCtrlKCtrlC
Remove a line commentTwo-stroke chord.CtrlKCtrlUCmdKCmdUCtrlKCtrlU
Toggle a line commentCtrl/Cmd/Ctrl/
Toggle a block commentShiftAltAShiftOptionACtrlShiftA
Trigger suggestionsCtrlSpaceCtrlSpaceCtrlSpace
Trigger parameter hintsCtrlShiftSpaceShiftCmdSpaceCtrlShiftSpace
Format the documentShiftAltFShiftOptionFCtrlShiftI
Format the selectionTwo-stroke chord.CtrlKCtrlFCmdKCmdFCtrlKCtrlF
Go to definitionF12F12F12
Show hover informationTwo-stroke chord.CtrlKCtrlICmdKCmdICtrlKCtrlI
Peek the definitionAltF12OptionF12CtrlShiftF10
Open the definition to the sideTwo-stroke chord.CtrlKF12CmdKF12CtrlKF12
Open quick fixesCtrl.Cmd.Ctrl.
Go to referencesShiftF12ShiftF12ShiftF12
Rename the symbolF2F2F2
Replace with the next valueCtrlShift.ShiftCmd.CtrlShift.
Replace with the previous valueCtrlShift,ShiftCmd,CtrlShift,
Expand the syntax-tree selectionShiftAltRightCtrlShiftCmdRightShiftAltRight
Shrink the syntax-tree selectionShiftAltLeftCtrlShiftCmdLeftShiftAltLeft
Trim trailing whitespaceTwo-stroke chord.CtrlKCtrlXCmdKCmdXCtrlKCtrlX
Change the language modeTwo-stroke chord.CtrlKMCmdKMCtrlKM

Editor, window, and group management

Split editors, move groups, close and reopen tabs, and focus the part of the workspace you need.

ActionWindowsmacOSLinux
Open a new windowCtrlShiftNCmdShiftNCtrlShiftN
Close the windowAltF4CmdShiftWCtrlShiftW
Close the active editorCtrlF4CmdWCtrlW
Close the current folderTwo-stroke chord.CtrlKFCmdKFCtrlKF
Split the editorCtrl\Cmd\Ctrl\
Focus the first editor groupCtrl1Cmd1Ctrl1
Focus the second editor groupCtrl2Cmd2Ctrl2
Focus the third editor groupCtrl3Cmd3Ctrl3
Focus the editor group on the leftTwo-stroke chord.CtrlKCtrlLeftCmdKCmdLeftCtrlKCtrlLeft
Focus the editor group on the rightTwo-stroke chord.CtrlKCtrlRightCmdKCmdRightCtrlKCtrlRight
Move the editor left in its groupCtrlShiftPageUpCmdKShiftCmdLeftCtrlShiftPageUp
Move the editor right in its groupCtrlShiftPageDownCmdKShiftCmdRightCtrlShiftPageDown
Move the active editor group leftTwo-stroke chord.CtrlKLeftCmdKLeftCtrlKLeft
Move the active editor group rightTwo-stroke chord.CtrlKRightCmdKRightCtrlKRight
Move the editor to the next groupCtrlAltRightCtrlCmdRightCtrlAltRight
Move the editor to the previous groupCtrlAltLeftCtrlCmdLeftCtrlAltLeft

Files, display, and terminal

Save and reopen work, manage tabs, change the workspace display, focus panels, and use the integrated terminal.

ActionWindowsmacOSLinux
Create a new fileCtrlNCmdNCtrlN
Open a fileCtrlOCmdOCtrlO
SaveCtrlSCmdSCtrlS
Save allThe current Linux default list does not assign a Save All key.CtrlKSOptionCmdSNot documented
Save asCtrlShiftSCmdShiftSCtrlShiftS
Close all editors in the groupTwo-stroke chord.CtrlKWCmdKWCtrlKW
Close all editorsTwo-stroke chord.CtrlKCtrlWCmdKCmdWCtrlKCtrlW
Reopen the closed editorCtrlShiftTCmdShiftTCtrlShiftT
Keep the active editor openTwo-stroke chord.CtrlKEnterCmdKEnterCtrlKEnter
Copy the active file pathTwo-stroke chord.CtrlKPCmdKPCtrlKP
Reveal the active file in the file managerTwo-stroke chord.CtrlKRCmdKRCtrlKR
Toggle fullscreenF11CtrlCmdFF11
Toggle Zen ModeTwo-stroke chord.CtrlKZCmdKZCtrlKZ
Leave Zen ModeEscEscEscEscEscEsc
Zoom inCtrl=Cmd=Ctrl=
Zoom outCtrl-Cmd-Ctrl-
Reset zoomCtrlNumpad0CmdNumpad0CtrlNumpad0
Toggle sidebar visibilityCtrlBCmdBCtrlB
Show Explorer and focus itCtrlShiftECmdShiftECtrlShiftE
Show Source ControlCtrlShiftGCtrlShiftGCtrlShiftG
Show Run and DebugCtrlShiftDCmdShiftDCtrlShiftD
Show ExtensionsCtrlShiftXCmdShiftXCtrlShiftX
Toggle the Output panelCtrlShiftUCmdShiftUCtrlKCtrlH
Open Quick Open ViewThe current Linux default list does not assign this key.CtrlQCtrlQNot documented
Open a new command promptCtrlShiftCCmdShiftCCtrlShiftC
Toggle Markdown previewCtrlShiftVCmdShiftVCtrlShiftV
Open preview to the sideTwo-stroke chord.CtrlKVCmdKVCtrlKV
Toggle the integrated terminalCtrl`Ctrl`Ctrl`

Preferences, chat, debug, and tasks

Change VS Code's configuration, use built-in chat, start and control debugging, and run the default build task.

ActionWindowsmacOSLinux
Open SettingsCtrl,Cmd,Ctrl,
Open Keyboard ShortcutsTwo-stroke chord.CtrlKCtrlSCmdKCmdSCtrlKCtrlS
Select a color themeTwo-stroke chord.CtrlKCtrlTCmdKCmdTCtrlKCtrlT
Open Chat viewCtrlAltICtrlCmdICtrlAltI
Open chat in agent modeCtrlShiftIShiftCmdICtrlShiftAltI
Open editor inline chatCtrlICmdICtrlI
Open terminal inline chatCtrlICmdICtrlI
Open quick chatCtrlShiftAltLShiftOptionCmdLCtrlShiftAltL
Open the chat agent pickerCtrl.Cmd.Ctrl.
Open the language model pickerCtrlAlt.OptionCmd.CtrlAlt.
Start a new chat sessionCtrlNCmdNCtrlN
Accept an inline suggestionTabTabTab
Toggle a breakpointF9F9F9
Start debuggingF5F5F5
Continue debuggingF5F5F5
Run without debuggingCtrlF5CtrlF5CtrlF5
Pause debuggingF6F6F6
Step intoF11F11F11
Run the build taskCtrlShiftBCmdShiftBCtrlShiftB

Make a printable Visual Studio Code sheet