Key Bindings for Visual Studio Code

Visual Studio Code lets you perform most tasks directly from the keyboard. This page lists out the default bindings (keyboard shortcuts) and describes how you can update them.

Note: If you visit this page on a Mac, you will see the key bindings for the Mac. If you visit using Windows or Linux, you will see the keys for that platform. If you need the key bindings for another platform, hover your mouse over the key you are interested in.

Keyboard Shortcuts editor

Visual Studio Code provides a rich and easy keyboard shortcuts editing experience using Keyboard Shortcuts editor. It lists all available commands with and without keybindings and you can easily change / remove / reset their keybindings using the available actions. It also has a search box on the top that helps you in finding commands or keybindings. You can open this editor by going to the menu under File > Preferences > Keyboard Shortcuts. (Code > Preferences > Keyboard Shortcuts on macOS)

Keyboard Shortcuts

Most importantly, you can see keybindings according to your keyboard layout. For example, key binding kbstyle(Cmd+\) in US keyboard layout will be shown as kbstyle(Ctrl+Shift+Alt+Cmd+7) when layout is changed to German. The dialog to enter key binding will assign the correct and desired key binding as per your keyboard layout.

For doing more advanced keyboard shortcut customization, read Advanced Customization.

Keymap extensions

Keyboard shortcuts are vital to productivity and changing keyboarding habits can be tough. To help with this, File > Preferences > Keymap Extensions shows you a list of popular keymap extensions. These extensions modify the VS Code shortcuts to match those of other editors so you don’t need to learn new keyboard shortcuts. There is also a Keymaps category of extensions in the Marketplace.

Tip: Click on an extension tile above to read the description and reviews to decide which extension is best for you. See more in the Marketplace.

Keyboard Shortcuts Reference

We also have a printable version of these keyboard shortcuts. Help > Keyboard Shortcut Reference displays a condensed PDF version suitable for printing as an easy reference.

Below are links to the three platform-specific versions:

Detecting keybinding conflicts

If you have many extensions installed or you have customized your keyboard shortcuts, you can sometimes have keybinding conflicts where the same keyboard shortcut is mapped to several commands. This can result in confusing behavior, especially if different keybindings are going in and out of scope as you move around the editor.

The Keyboard Shortcuts editor has a context menu command Show Same Keybindings, which will filter the keybindings based on a keyboard shortcut to display conflicts.

show keybinding conflicts menu

Pick a command with the keybinding you think is overloaded and you can see if multiple commands are defined, the source of the keybindings and when they are active.

show keybinding conflicts result

Viewing modified keybindings

You can view any user modified keyboard shortcuts in VS Code in the Keyboard Shortcuts editor with the Show User Keybindings command in the More Actions () menu. This applies the @source:user filter to the Keyboard Shortcuts editor (Source is ‘User’).

Default Keyboard Shortcuts

Advanced customization

All keyboard shortcuts in VS Code can be customized via the keybindings.json file.

  • To configure keyboard shortcuts through the JSON file, open Keyboard Shortcuts editor and select the Open Keyboard Shortcuts (JSON) button on the right of the editor title bar.
  • This will open your keybindings.json file where you can overwrite the Default Keybindings.

Open Keyboard Shortcuts JSON button

You can also open the keybindings.json file from the Command Palette (kb(workbench.action.showCommands)) with the Preferences: Open Keyboard Shortcuts (JSON) command.

Keyboard rules

Each rule consists of:

  • a key that describes the pressed keys.
  • a command containing the identifier of the command to execute.
  • an optional when clause containing a boolean expression that will be evaluated depending on the current context.

Chords (two separate keypress actions) are described by separating the two keypresses with a space. For example, kbstyle(Ctrl+K Ctrl+C).

When a key is pressed:

  • the rules are evaluated from bottom to top.
  • the first rule that matches, both the key and in terms of when, is accepted.
  • no more rules are processed.
  • if a rule is found and has a command set, the command is executed.

The additional keybindings.json rules are appended at runtime to the bottom of the default rules, thus allowing them to overwrite the default rules. The keybindings.json file is watched by VS Code so editing it while VS Code is running will update the rules at runtime.

The keyboard shortcuts dispatching is done by analyzing a list of rules that are expressed in JSON. Here are some examples:

  1. // Keybindings that are active when the focus is in the editor
  2. { "key": "home", "command": "cursorHome", "when": "editorTextFocus" },
  3. { "key": "shift+home", "command": "cursorHomeSelect", "when": "editorTextFocus" },
  4. // Keybindings that are complementary
  5. { "key": "f5", "command": "workbench.action.debug.continue", "when": "inDebugMode" },
  6. { "key": "f5", "command": "workbench.action.debug.start", "when": "!inDebugMode" },
  7. // Global keybindings
  8. { "key": "ctrl+f", "command": "actions.find" },
  9. { "key": "alt+left", "command": "workbench.action.navigateBack" },
  10. { "key": "alt+right", "command": "workbench.action.navigateForward" },
  11. // Global keybindings using chords (two separate keypress actions)
  12. { "key": "ctrl+k enter", "command": "workbench.action.keepEditor" },
  13. { "key": "ctrl+k ctrl+w", "command": "workbench.action.closeAllEditors" },

Accepted keys

The key is made up of modifiers and the key itself.

The following modifiers are accepted:

PlatformModifiers
macOSkbstyle(Ctrl+), kbstyle(Shift+), kbstyle(Alt+), kbstyle(Cmd+)
Windowskbstyle(Ctrl+), kbstyle(Shift+), kbstyle(Alt+), kbstyle(Win+)
Linuxkbstyle(Ctrl+), kbstyle(Shift+), kbstyle(Alt+), kbstyle(Meta+)

The following keys are accepted:

  • kbstyle(f1-f19), kbstyle(a-z), kbstyle(0-9)
  • kbstyle(`), kbstyle(-), kbstyle(=), kbstyle([), kbstyle(]), kbstyle(\), kbstyle(;), kbstyle('), kbstyle(,), kbstyle(.), kbstyle(/)
  • kbstyle(left), kbstyle(up), kbstyle(right), kbstyle(down), kbstyle(pageup), kbstyle(pagedown), kbstyle(end), kbstyle(home)
  • kbstyle(tab), kbstyle(enter), kbstyle(escape), kbstyle(space), kbstyle(backspace), kbstyle(delete)
  • kbstyle(pausebreak), kbstyle(capslock), kbstyle(insert)
  • kbstyle(numpad0-numpad9), kbstyle(numpad_multiply), kbstyle(numpad_add), kbstyle(numpad_separator)
  • kbstyle(numpad_subtract), kbstyle(numpad_decimal), kbstyle(numpad_divide)

Command arguments

You can invoke a command with arguments. This is useful if you often perform the same operation on a specific file or folder. You can add a custom keyboard shortcut to do exactly what you want.

The following is an example overriding the kbstyle(Enter) key to print some text:

  1. { "key": "enter", "command": "type",
  2. "args": { "text": "Hello World" },
  3. "when": "editorTextFocus" }

The type command will receive {"text": "Hello World"} as its first argument and add “Hello World” to the file instead of producing the default command.

For more information on commands that take arguments, refer to Built-in Commands.

Removing a specific key binding rule

You can write a key binding rule that targets the removal of a specific default key binding. With the keybindings.json, it was always possible to redefine all the key bindings of VS Code, but it can be difficult to make a small tweak, especially around overloaded keys, such as kbstyle(Tab) or kbstyle(Escape). To remove a specific key binding, add a - to the command and the rule will be a removal rule.

Here is an example:

  1. // In Default Keyboard Shortcuts
  2. ...
  3. { "key": "tab", "command": "tab", "when": ... },
  4. { "key": "tab", "command": "jumpToNextSnippetPlaceholder", "when": ... },
  5. { "key": "tab", "command": "acceptSelectedSuggestion", "when": ... },
  6. ...
  7. // To remove the second rule, for example, add in keybindings.json:
  8. { "key": "tab", "command": "-jumpToNextSnippetPlaceholder" }

Keyboard layouts

Note: This section relates only to key bindings, not to typing in the editor.

The keys above are string representations for virtual keys and do not necessarily relate to the produced character when they are pressed. More precisely:

  • Reference: Virtual-Key Codes (Windows)
  • kbstyle(tab) for VK_TAB (0x09)
  • kbstyle(;) for VK_OEM_1 (0xBA)
  • kbstyle(=) for VK_OEM_PLUS (0xBB)
  • kbstyle(,) for VK_OEM_COMMA (0xBC)
  • kbstyle(-) for VK_OEM_MINUS (0xBD)
  • kbstyle(.) for VK_OEM_PERIOD (0xBE)
  • kbstyle(/) for VK_OEM_2 (0xBF)
  • kbstyle(`) for VK_OEM_3 (0xC0)
  • kbstyle([) for VK_OEM_4 (0xDB)
  • kbstyle(\) for VK_OEM_5 (0xDC)
  • kbstyle(]) for VK_OEM_6 (0xDD)
  • kbstyle(') for VK_OEM_7 (0xDE)
  • etc.

Different keyboard layouts usually reposition the above virtual keys or change the characters produced when they are pressed. When using a different keyboard layout than the standard US, Visual Studio Code does the following:

All the key bindings are rendered in the UI using the current system’s keyboard layout. For example, Split Editor when using a French (France) keyboard layout is now rendered as kbstyle(Ctrl+*):

render key binding

When editing keybindings.json, VS Code highlights misleading key bindings, those that are represented in the file with the character produced under the standard US keyboard layout, but that need pressing keys with different labels under the current system’s keyboard layout. For example, here is how the Default Keyboard Shortcuts rules look like when using a French (France) keyboard layout:

keybindings.json guidance

There is also a widget that helps input the key binding rule when editing keybindings.json. To launch the Define Keybinding widget, press kb(editor.action.defineKeybinding). The widget listens for key presses and renders the serialized JSON representation in the text box and below it, the keys that VS Code has detected under your current keyboard layout. Once you’ve typed the key combination you want, you can press kbstyle(Enter) and a rule snippet will be inserted.

key binding widget

Note: On Linux, Visual Studio Code detects your current keyboard layout on start-up and then caches this information. For a good experience, we recommend restarting VS Code if you change your keyboard layout.

Keyboard layout-independent bindings

Using scan codes, it is possible to define keybindings which do not change with the change of the keyboard layout. For example:

  1. { "key": "cmd+[Slash]", "command": "editor.action.commentLine",
  2. "when": "editorTextFocus" }

Accepted scan codes:

  • kbstyle([F1]-[F19]), kbstyle([KeyA]-[KeyZ]), kbstyle([Digit0]-[Digit9])
  • kbstyle([Backquote]), kbstyle([Minus]), kbstyle([Equal]), kbstyle([BracketLeft]), kbstyle([BracketRight]), kbstyle([Backslash]), kbstyle([Semicolon]), kbstyle([Quote]), kbstyle([Comma]), kbstyle([Period]), kbstyle([Slash])
  • kbstyle([ArrowLeft]), kbstyle([ArrowUp]), kbstyle([ArrowRight]), kbstyle([ArrowDown]), kbstyle([PageUp]), kbstyle([PageDown]), kbstyle([End]), kbstyle([Home])
  • kbstyle([Tab]), kbstyle([Enter]), kbstyle([Escape]), kbstyle([Space]), kbstyle([Backspace]), kbstyle([Delete])
  • kbstyle([Pause]), kbstyle([CapsLock]), kbstyle([Insert])
  • kbstyle([Numpad0]-[Numpad9]), kbstyle([NumpadMultiply]), kbstyle([NumpadAdd]), kbstyle([NumpadComma])
  • kbstyle([NumpadSubtract]), kbstyle([NumpadDecimal]), kbstyle([NumpadDivide])

‘when’ clause contexts

VS Code gives you fine control over when your key bindings are enabled through the optional when clause. If your key binding doesn’t have a when clause, the key binding is globally available at all times. A when clause evaluates to either Boolean true or false for enabling key bindings.

Conditional operators

For conditional expressions, you can use the following conditional operators:

OperatorSymbolExample
Equality==“editorLangId == typescript”
Inequality!=“resourceExtname != .js”
Or</td><td></td></tr><tr><td>And</td><td><code>&amp;&amp;</code></td><td><code>"textInputFocus &amp;&amp; !editorReadonly"</code></td></tr><tr><td>Matches</td><td><code>=~</code></td><td>resourceScheme =~ /^untitled$

Contexts

Below are some of the possible when clause contexts which evaluate to Boolean true/false.

Context nameTrue when
Editor contexts
editorFocusAn editor has focus, either the text or a widget.
editorTextFocusThe text in an editor has focus (cursor is blinking).
textInputFocusAny editor has focus (regular editor, debug REPL, etc.).
inputFocusAny text input area has focus (editors or text boxes).
editorHasSelectionText is selected in the editor.
editorHasMultipleSelectionsMultiple regions of text are selected (multiple cursors).
editorReadonlyThe editor is read only.
editorLangIdTrue when the editor’s associated language Id matches. Example: “editorLangId == typescript”.
isInDiffEditorThe active editor is a difference editor.
isInEmbeddedEditorTrue when the focus is inside an embedded editor.
Operating system contexts
isLinuxTrue when the OS is Linux
isMacTrue when the OS is macOS
isWindowsTrue when the OS is Windows
isWebTrue when accessing the editor from the Web
List contexts
listFocusA list has focus.
listSupportsMultiselectA list supports multi select.
listHasSelectionOrFocusA list has selection or focus.
listDoubleSelectionA list has a selection of 2 elements.
listMultiSelectionA list has a selection of multiple elements.
Mode contexts
inDebugModeA debug session is running.
debugTypeTrue when debug type matches. Example: “debugType == ‘node’”.
inSnippetModeThe editor is in snippet mode.
inQuickOpenThe Quick Open drop-down has focus.
Resource contexts
resourceSchemeTrue when the resource Uri scheme matches. Example: “resourceScheme == file”
resourceFilenameTrue when the Explorer or editor filename matches. Example: “resourceFilename == gulpfile.js”
resourceExtnameTrue when the Explorer or editor filename extension matches. Example: “resourceExtname == .js”
resourceLangIdTrue when the Explorer or editor title language Id matches. Example: “resourceLangId == markdown”
isFileSystemResourceTrue when the Explorer or editor file is a file system resource that can be handled from a file system provider
resourceSetTrue when an Explorer or editor file is set
resourceThe full Uri of the Explorer or editor file
Explorer contexts
explorerViewletVisibleTrue if Explorer view is visible.
explorerViewletFocusTrue if Explorer view has keyboard focus.
filesExplorerFocusTrue if File Explorer section has keyboard focus.
openEditorsFocusTrue if OPEN EDITORS section has keyboard focus.
explorerResourceIsFolderTrue if a folder is selected in the Explorer.
Editor widget contexts
findWidgetVisibleEditor Find widget is visible.
suggestWidgetVisibleSuggestion widget (IntelliSense) is visible.
suggestWidgetMultipleSuggestionsMultiple suggestions are displayed.
renameInputVisibleRename input text box is visible.
referenceSearchVisiblePeek References peek window is open.
inReferenceSearchEditorThe Peek References peek window editor has focus.
config.editor.stablePeekKeep peek editors open (controlled by editor.stablePeek setting).
quickFixWidgetVisibleQuick Fix widget is visible.
parameterHintsVisibleParameter hints are visible (controlled by editor.parameterHints.enabled setting).
parameterHintsMultipleSignaturesMultiple parameter hints are displayed.
Integrated terminal contexts
terminalFocusAn integrated terminal has focus.
terminalIsOpenAn integrated terminal is opened.
Timeline view contexts
timelineFollowActiveEditorTrue if the Timeline view is following the active editor.
Timeline view item contexts
timelineItemTrue when the timeline item’s context value matches. Example: “timelineItem =~ /git:file:commit\b/“.
Extension contexts
extensionTrue when the extension’s ID matches. Example: “extension == eamodio.gitlens”.
extensionStatusTrue when the extension is installed. Example: “extensionStatus == installed”.
extensionHasConfigurationTrue if the extension has configuration.
Global UI contexts
notificationFocusNotification has keyboard focus.
notificationCenterVisibleNotification Center is visible at the bottom right of VS Code.
notificationToastsVisibleNotification toast is visible at the bottom right of VS Code.
searchViewletVisibleSearch view is open.
sideBarVisibleSide Bar is displayed.
sideBarFocusSide Bar has focus.
panelFocusPanel has focus.
inZenModeWindow is in Zen Mode.
isCenteredLayoutEditor is in centered layout mode.
inDebugReplFocus is in the Debug Console REPL.
workbenchStateCan be empty, folder (1 folder), or workspace.
workspaceFolderCountCount of workspace folders.
replaceActiveSearch view Replace text box is open.
viewTrue when view identifier matches. Example: “view == myViewsExplorerID”.
viewItemTrue when viewItem context matches. Example: “viewItem == someContextValue”.
isFullscreenTrue when window is in fullscreen.
focusedViewThe identifier of the currently focused view.
canNavigateBackTrue if it is possible to navigate back.
canNavigateForwardTrue if it is possible to navigate forward.
canNavigateToLastEditLocationTrue if it is possible to navigate to the last edit location.
Global Editor UI contexts
textCompareEditorVisibleAt least one diff (compare) editor is visible.
textCompareEditorActiveA diff (compare) editor is active.
editorIsOpenTrue if one editor is open.
groupActiveEditorDirtyTrue when the active editor in a group is dirty.
groupEditorsCountNumber of editors in a group.
activeEditorGroupEmptyTrue if the active editor group has no editors.
activeEditorGroupIndexIndex of the active editor in an group (beginning with 1).
activeEditorGroupLastTrue when the active editor in an group is the last one.
multipleEditorGroupsTrue when multiple editor groups are present.
editorPinnedTrue when the active editor in a group is pinned (not in preview mode).
activeEditorThe identifier of the active editor in a group.
Configuration settings contexts
config.editor.minimap.enabledTrue when the setting editor.minimap.enabled is true.

Note: You can use any user or workspace setting that evaluates to a boolean here with the prefix "config.".

The list above isn’t exhaustive and you may see some when contexts for specific VS Code UI in the Default Keyboard Shortcuts.

Active/Focused view or panel ‘when’ clause context

You can have a keybinding that is enabled only when a specific view or panel is visible.

Context nameTrue when
activeViewletTrue when view is visible. Example: “activeViewlet == ‘workbench.view.explorer’”
activePanelTrue when panel is visible. Example: “activePanel == ‘workbench.panel.output’”
focusedViewTrue when view is focused. Example: “focusedView == myViewsExplorerID

View Identifiers:

  • workbench.view.explorer - File Explorer
  • workbench.view.search - Search
  • workbench.view.scm - Source Control
  • workbench.view.debug - Run
  • workbench.view.extensions - Extensions

Panel Identifiers:

  • workbench.panel.markers - Problems
  • workbench.panel.output - Output
  • workbench.panel.repl - Debug Console
  • workbench.panel.terminal - Integrated Terminal
  • workbench.panel.comments - Comments
  • workbench.view.search - Search when search.location is set to panel

If you want a keybinding that is enabled only when a specific view or panel has focus, use sideBarFocus or panelFocus in combination with activeViewlet or activiewFocus.

For example, the when clause below is true only when the File Explorer has focus:

  1. "sideBarFocus && activeViewlet == 'workbench.view.explorer'"

key-value when clause operator

There is a key-value pair operator for when clauses. The expression key =~ value treats the right hand side as a regular expression to match against the left hand side. For example, to contribute context menu items for all Docker files, one could use:

  1. "when": "resourceFilename =~ /docker/"

Custom keybindings for refactorings

The editor.action.codeAction command lets you configure keybindings for specific Refactorings (Code Actions). For example, the keybinding below triggers the Extract function refactoring Code Actions:

  1. {
  2. "key": "ctrl+shift+r ctrl+e",
  3. "command": "editor.action.codeAction",
  4. "args": {
  5. "kind": "refactor.extract.function"
  6. }
  7. }

This is covered in depth in the Refactoring topic where you can learn about different kinds of Code Actions and how to prioritize them in the case of multiple possible refactorings.

Default Keyboard Shortcuts

You can view all default keyboard shortcuts in VS Code in the Keyboard Shortcuts editor with the Show Default Keybindings command in the More Actions () menu. This applies the @source:default filter to the Keyboard Shortcuts editor (Source is ‘Default’).

Default Keyboard Shortcuts

You can view the default keyboard shortcuts as a JSON file using the command Preferences: Open Default Keyboard Shortcuts (JSON).

Note: The following keys are rendered assuming a standard US keyboard layout. If you use a different keyboard layout, please read below. You can view the currently active keyboard shortcuts in VS Code in the Command Palette (View -> Command Palette) or in the Keyboard Shortcuts editor (File > Preferences > Keyboard Shortcuts).

Some commands included below do not have default keyboard shortcuts and so are displayed as kbstyle(unassigned) but you can assign your own keybindings.

Basic Editing

CommandKeyCommand id
Cut line (empty selection)kb(editor.action.clipboardCutAction)editor.action.clipboardCutAction
Copy line (empty selection)kb(editor.action.clipboardCopyAction)editor.action.clipboardCopyAction
Pastekb(editor.action.clipboardPasteAction)editor.action.clipboardPasteAction
Delete Linekb(editor.action.deleteLines)editor.action.deleteLines
Insert Line Belowkb(editor.action.insertLineAfter)editor.action.insertLineAfter
Insert Line Abovekb(editor.action.insertLineBefore)editor.action.insertLineBefore
Move Line Downkb(editor.action.moveLinesDownAction)editor.action.moveLinesDownAction
Move Line Upkb(editor.action.moveLinesUpAction)editor.action.moveLinesUpAction
Copy Line Downkb(editor.action.copyLinesDownAction)editor.action.copyLinesDownAction
Copy Line Upkb(editor.action.copyLinesUpAction)editor.action.copyLinesUpAction
Undokb(undo)undo
Redokb(redo)redo
Add Selection To Next Find Matchkb(editor.action.addSelectionToNextFindMatch)editor.action.addSelectionToNextFindMatch
Move Last Selection To Next Find Matchkb(editor.action.moveSelectionToNextFindMatch)editor.action.moveSelectionToNextFindMatch
Undo last cursor operationkb(cursorUndo)cursorUndo
Insert cursor at end of each line selectedkb(editor.action.insertCursorAtEndOfEachLineSelected)editor.action.insertCursorAtEndOfEachLineSelected
Select all occurrences of current selectionkb(editor.action.selectHighlights)editor.action.selectHighlights
Select all occurrences of current wordkb(editor.action.changeAll)editor.action.changeAll
Select current linekb(expandLineSelection)expandLineSelection
Insert Cursor Belowkb(editor.action.insertCursorBelow)editor.action.insertCursorBelow
Insert Cursor Abovekb(editor.action.insertCursorAbove)editor.action.insertCursorAbove
Jump to matching bracketkb(editor.action.jumpToBracket)editor.action.jumpToBracket
Indent Linekb(editor.action.indentLines)editor.action.indentLines
Outdent Linekb(editor.action.outdentLines)editor.action.outdentLines
Go to Beginning of Linekb(cursorHome)cursorHome
Go to End of Linekb(cursorEnd)cursorEnd
Go to End of Filekb(cursorBottom)cursorBottom
Go to Beginning of Filekb(cursorTop)cursorTop
Scroll Line Downkb(scrollLineDown)scrollLineDown
Scroll Line Upkb(scrollLineUp)scrollLineUp
Scroll Page Downkb(scrollPageDown)scrollPageDown
Scroll Page Upkb(scrollPageUp)scrollPageUp
Fold (collapse) regionkb(editor.fold)editor.fold
Unfold (uncollapse) regionkb(editor.unfold)editor.unfold
Fold (collapse) all subregionskb(editor.foldRecursively)editor.foldRecursively
Unfold (uncollapse) all subregionskb(editor.unfoldRecursively)editor.unfoldRecursively
Fold (collapse) all regionskb(editor.foldAll)editor.foldAll
Unfold (uncollapse) all regionskb(editor.unfoldAll)editor.unfoldAll
Add Line Commentkb(editor.action.addCommentLine)editor.action.addCommentLine
Remove Line Commentkb(editor.action.removeCommentLine)editor.action.removeCommentLine
Toggle Line Commentkb(editor.action.commentLine)editor.action.commentLine
Toggle Block Commentkb(editor.action.blockComment)editor.action.blockComment
Findkb(actions.find)actions.find
Replacekb(editor.action.startFindReplaceAction)editor.action.startFindReplaceAction
Find Nextkb(editor.action.nextMatchFindAction)editor.action.nextMatchFindAction
Find Previouskb(editor.action.previousMatchFindAction)editor.action.previousMatchFindAction
Select All Occurrences of Find Matchkb(editor.action.selectAllMatches)editor.action.selectAllMatches
Toggle Find Case Sensitivekb(toggleFindCaseSensitive)toggleFindCaseSensitive
Toggle Find Regexkb(toggleFindRegex)toggleFindRegex
Toggle Find Whole Wordkb(toggleFindWholeWord)toggleFindWholeWord
Toggle Use of Tab Key for Setting Focuskb(editor.action.toggleTabFocusMode)editor.action.toggleTabFocusMode
Toggle Render Whitespacekb(toggleRenderWhitespace)toggleRenderWhitespace
Toggle Word Wrapkb(editor.action.toggleWordWrap)editor.action.toggleWordWrap

Rich Languages Editing

CommandKeyCommand id
Trigger Suggestkb(editor.action.triggerSuggest)editor.action.triggerSuggest
Trigger Parameter Hintskb(editor.action.triggerParameterHints)editor.action.triggerParameterHints
Format Documentkb(editor.action.formatDocument)editor.action.formatDocument
Format Selectionkb(editor.action.formatSelection)editor.action.formatSelection
Go to Definitionkb(editor.action.revealDefinition)editor.action.revealDefinition
Show Hoverkb(editor.action.showHover)editor.action.showHover
Peek Definitionkb(editor.action.peekDefinition)editor.action.peekDefinition
Open Definition to the Sidekb(editor.action.revealDefinitionAside)editor.action.revealDefinitionAside
Quick Fixkb(editor.action.quickFix)editor.action.quickFix
Go to Referenceskb(editor.action.goToReferences)editor.action.goToReferences
Rename Symbolkb(editor.action.rename)editor.action.rename
Replace with Next Valuekb(editor.action.inPlaceReplace.down)editor.action.inPlaceReplace.down
Replace with Previous Valuekb(editor.action.inPlaceReplace.up)editor.action.inPlaceReplace.up
Expand AST Selectionkb(editor.action.smartSelect.expand)editor.action.smartSelect.expand
Shrink AST Selectionkb(editor.action.smartSelect.shrink)editor.action.smartSelect.shrink
Trim Trailing Whitespacekb(editor.action.trimTrailingWhitespace)editor.action.trimTrailingWhitespace
Change Language Modekb(workbench.action.editor.changeLanguageMode)workbench.action.editor.changeLanguageMode

Navigation

CommandKeyCommand id
Show All Symbolskb(workbench.action.showAllSymbols)workbench.action.showAllSymbols
Go to Line…kb(workbench.action.gotoLine)workbench.action.gotoLine
Go to File…, Quick Openkb(workbench.action.quickOpen)workbench.action.quickOpen
Go to Symbol…kb(workbench.action.gotoSymbol)workbench.action.gotoSymbol
Show Problemskb(workbench.actions.view.problems)workbench.actions.view.problems
Go to Next Error or Warningkb(editor.action.marker.nextInFiles)editor.action.marker.nextInFiles
Go to Previous Error or Warningkb(editor.action.marker.prevInFiles)editor.action.marker.prevInFiles
Show All Commandskb(workbench.action.showCommands) or kbstyle(F1)workbench.action.showCommands
Navigate Editor Group Historykb(workbench.action.quickOpenPreviousRecentlyUsedEditorInGroup)workbench.action.quickOpenPreviousRecentlyUsedEditorInGroup
Go Backkb(workbench.action.navigateBack)workbench.action.navigateBack
Go back in Quick Inputkb(workbench.action.quickInputBack)workbench.action.quickInputBack
Go Forwardkb(workbench.action.navigateForward)workbench.action.navigateForward

Editor/Window Management

CommandKeyCommand id
New Windowkb(workbench.action.newWindow)workbench.action.newWindow
Close Windowkb(workbench.action.closeWindow)workbench.action.closeWindow
Close Editorkb(workbench.action.closeActiveEditor)workbench.action.closeActiveEditor
Close Folderkb(workbench.action.closeFolder)workbench.action.closeFolder
Cycle Between Editor Groupskb(workbench.action.navigateEditorGroups)workbench.action.navigateEditorGroups
Split Editorkb(workbench.action.splitEditor)workbench.action.splitEditor
Focus into First Editor Groupkb(workbench.action.focusFirstEditorGroup)workbench.action.focusFirstEditorGroup
Focus into Second Editor Groupkb(workbench.action.focusSecondEditorGroup)workbench.action.focusSecondEditorGroup
Focus into Third Editor Groupkb(workbench.action.focusThirdEditorGroup)workbench.action.focusThirdEditorGroup
Focus into Editor Group on the Leftkb(workbench.action.focusPreviousGroup)workbench.action.focusPreviousGroup
Focus into Editor Group on the Rightkb(workbench.action.focusNextGroup)workbench.action.focusNextGroup
Move Editor Leftkb(workbench.action.moveEditorLeftInGroup)workbench.action.moveEditorLeftInGroup
Move Editor Rightkb(workbench.action.moveEditorRightInGroup)workbench.action.moveEditorRightInGroup
Move Active Editor Group Leftkb(workbench.action.moveActiveEditorGroupLeft)workbench.action.moveActiveEditorGroupLeft
Move Active Editor Group Rightkb(workbench.action.moveActiveEditorGroupRight)workbench.action.moveActiveEditorGroupRight
Move Editor into Next Groupkb(workbench.action.moveEditorToNextGroup)workbench.action.moveEditorToNextGroup
Move Editor into Previous Groupkb(workbench.action.moveEditorToPreviousGroup)workbench.action.moveEditorToPreviousGroup

File Management

CommandKeyCommand id
New Filekb(workbench.action.files.newUntitledFile)workbench.action.files.newUntitledFile
Open File…kb(workbench.action.files.openFile)workbench.action.files.openFile
Savekb(workbench.action.files.save)workbench.action.files.save
Save Allkb(workbench.action.files.saveAll)workbench.action.files.saveAll
Save As…kb(workbench.action.files.saveAs)workbench.action.files.saveAs
Closekb(workbench.action.closeActiveEditor)workbench.action.closeActiveEditor
Close Otherskb(workbench.action.closeOtherEditors)workbench.action.closeOtherEditors
Close Groupkb(workbench.action.closeEditorsInGroup)workbench.action.closeEditorsInGroup
Close Other Groupskb(workbench.action.closeEditorsInOtherGroups)workbench.action.closeEditorsInOtherGroups
Close Group to Leftkb(workbench.action.closeEditorsToTheLeft)workbench.action.closeEditorsToTheLeft
Close Group to Rightkb(workbench.action.closeEditorsToTheRight)workbench.action.closeEditorsToTheRight
Close Allkb(workbench.action.closeAllEditors)workbench.action.closeAllEditors
Reopen Closed Editorkb(workbench.action.reopenClosedEditor)workbench.action.reopenClosedEditor
Keep Openkb(workbench.action.keepEditor)workbench.action.keepEditor
Copy Path of Active Filekb(workbench.action.files.copyPathOfActiveFile)workbench.action.files.copyPathOfActiveFile
Reveal Active File in Windowskb(workbench.action.files.revealActiveFileInWindows)workbench.action.files.revealActiveFileInWindows
Show Opened File in New Windowkb(workbench.action.files.showOpenedFileInNewWindow)workbench.action.files.showOpenedFileInNewWindow
Compare Opened File Withkb(workbench.files.action.compareFileWith)workbench.files.action.compareFileWith

Display

CommandKeyCommand id
Toggle Full Screenkb(workbench.action.toggleFullScreen)workbench.action.toggleFullScreen
Toggle Zen Modekb(workbench.action.toggleZenMode)workbench.action.toggleZenMode
Leave Zen Modekb(workbench.action.exitZenMode)workbench.action.exitZenMode
Zoom inkb(workbench.action.zoomIn)workbench.action.zoomIn
Zoom outkb(workbench.action.zoomOut)workbench.action.zoomOut
Reset Zoomkb(workbench.action.zoomReset)workbench.action.zoomReset
Toggle Sidebar Visibilitykb(workbench.action.toggleSidebarVisibility)workbench.action.toggleSidebarVisibility
Show Explorer / Toggle Focuskb(workbench.view.explorer)workbench.view.explorer
Show Searchkb(workbench.view.search)workbench.view.search
Show Source Controlkb(workbench.view.scm)workbench.view.scm
Show Runkb(workbench.view.debug)workbench.view.debug
Show Extensionskb(workbench.view.extensions)workbench.view.extensions
Show Outputkb(workbench.action.output.toggleOutput)workbench.action.output.toggleOutput
Quick Open Viewkb(workbench.action.quickOpenView)workbench.action.quickOpenView
Open New Command Promptkb(workbench.action.terminal.openNativeConsole)workbench.action.terminal.openNativeConsole
Toggle Markdown Previewkb(markdown.showPreview)markdown.showPreview
Open Preview to the Sidekb(markdown.showPreviewToSide)markdown.showPreviewToSide
Toggle Integrated Terminalkb(workbench.action.terminal.toggleTerminal)workbench.action.terminal.toggleTerminal

Search

CommandKeyCommand id
Show Searchkb(workbench.view.search)workbench.view.search
Replace in Fileskb(workbench.action.replaceInFiles)workbench.action.replaceInFiles
Toggle Match Casekb(toggleSearchCaseSensitive)toggleSearchCaseSensitive
Toggle Match Whole Wordkb(toggleSearchWholeWord)toggleSearchWholeWord
Toggle Use Regular Expressionkb(toggleSearchRegex)toggleSearchRegex
Toggle Search Detailskb(workbench.action.search.toggleQueryDetails)workbench.action.search.toggleQueryDetails
Focus Next Search Resultkb(search.action.focusNextSearchResult)search.action.focusNextSearchResult
Focus Previous Search Resultkb(search.action.focusPreviousSearchResult)search.action.focusPreviousSearchResult
Show Next Search Termkb(history.showNext)history.showNext
Show Previous Search Termkb(history.showPrevious)history.showPrevious

Preferences

CommandKeyCommand id
Open Settingskb(workbench.action.openSettings)workbench.action.openSettings
Open Workspace Settingskb(workbench.action.openWorkspaceSettings)workbench.action.openWorkspaceSettings
Open Keyboard Shortcutskb(workbench.action.openGlobalKeybindings)workbench.action.openGlobalKeybindings
Open User Snippetskb(workbench.action.openSnippets)workbench.action.openSnippets
Select Color Themekb(workbench.action.selectTheme)workbench.action.selectTheme
Configure Display Languagekb(workbench.action.configureLocale)workbench.action.configureLocale

Debug

CommandKeyCommand id
Toggle Breakpointkb(editor.debug.action.toggleBreakpoint)editor.debug.action.toggleBreakpoint
Startkb(workbench.action.debug.start)workbench.action.debug.start
Continuekb(workbench.action.debug.continue)workbench.action.debug.continue
Start (without debugging)kb(workbench.action.debug.run)workbench.action.debug.run
Pausekb(workbench.action.debug.pause)workbench.action.debug.pause
Step Intokb(workbench.action.debug.stepInto)workbench.action.debug.stepInto

Tasks

CommandKeyCommand id
Run Build Taskkb(workbench.action.tasks.build)workbench.action.tasks.build
Run Test Taskkb(workbench.action.tasks.test)workbench.action.tasks.test

Extensions

CommandKeyCommand id
Install Extensionkb(workbench.extensions.action.installExtension)workbench.extensions.action.installExtension
Show Installed Extensionskb(workbench.extensions.action.showInstalledExtensions)workbench.extensions.action.showInstalledExtensions
Show Outdated Extensionskb(workbench.extensions.action.listOutdatedExtensions)workbench.extensions.action.listOutdatedExtensions
Show Recommended Extensionskb(workbench.extensions.action.showRecommendedExtensions)workbench.extensions.action.showRecommendedExtensions
Show Popular Extensionskb(workbench.extensions.action.showPopularExtensions)workbench.extensions.action.showPopularExtensions
Update All Extensionskb(workbench.extensions.action.updateAllExtensions)workbench.extensions.action.updateAllExtensions

Next steps

Now that you know about our Key binding support, what’s next…

  • Language Support - Our Good, Better, Best language grid to see what you can expect
  • Debugging - This is where VS Code really shines
  • Node.js - End to end Node.js scenario with a sample app

Common questions

How can I find out what command is bound to a specific key?

In the Keyboard Shortcut editor, you can filter on specific keystrokes to see which commands are bound to which keys. Below you can see that kbstyle(Ctrl+Shift+P) is bound to Show All Commands to bring up the Command Palette.

Key bindings quick outline

How to add a key binding to an action, for example, add Ctrl+D to Delete Lines

Find a rule that triggers the action in the Default Keyboard Shortcuts and write a modified version of it in your keybindings.json file:

  1. // Original, in Default Keyboard Shortcuts
  2. { "key": "ctrl+shift+k", "command": "editor.action.deleteLines",
  3. "when": "editorTextFocus" },
  4. // Modified, in User/keybindings.json, Ctrl+D now will also trigger this action
  5. { "key": "ctrl+d", "command": "editor.action.deleteLines",
  6. "when": "editorTextFocus" },

How can I add a key binding for only certain file types?

Use the editorLangId context key in your when clause:

  1. { "key": "shift+alt+a", "command": "editor.action.blockComment",
  2. "when": "editorTextFocus && editorLangId == csharp" },

I have modified my key bindings in keybindings.json; why don’t they work?

The most common problem is a syntax error in the file. Otherwise, try removing the when clause or picking a different key. Unfortunately, at this point, it is a trial and error process.