- Key Bindings for Visual Studio Code
- Keyboard Shortcuts editor
- Keymap extensions
- Keyboard Shortcuts Reference
- Detecting keybinding conflicts
- Viewing modified keybindings
- Advanced customization
- Keyboard rules
- Accepted keys
- Command arguments
- Removing a specific key binding rule
- Keyboard layouts
- Keyboard layout-independent bindings
- ‘when’ clause contexts
- Custom keybindings for refactorings
- Default Keyboard Shortcuts
- File Management
- Next steps
- Common questions
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)
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.
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.
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’).
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.
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 ofwhen
, is accepted. - no more rules are processed.
- if a rule is found and has a
command
set, thecommand
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:
// Keybindings that are active when the focus is in the editor
{ "key": "home", "command": "cursorHome", "when": "editorTextFocus" },
{ "key": "shift+home", "command": "cursorHomeSelect", "when": "editorTextFocus" },
// Keybindings that are complementary
{ "key": "f5", "command": "workbench.action.debug.continue", "when": "inDebugMode" },
{ "key": "f5", "command": "workbench.action.debug.start", "when": "!inDebugMode" },
// Global keybindings
{ "key": "ctrl+f", "command": "actions.find" },
{ "key": "alt+left", "command": "workbench.action.navigateBack" },
{ "key": "alt+right", "command": "workbench.action.navigateForward" },
// Global keybindings using chords (two separate keypress actions)
{ "key": "ctrl+k enter", "command": "workbench.action.keepEditor" },
{ "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:
Platform | Modifiers |
---|---|
macOS | kbstyle(Ctrl+) , kbstyle(Shift+) , kbstyle(Alt+) , kbstyle(Cmd+) |
Windows | kbstyle(Ctrl+) , kbstyle(Shift+) , kbstyle(Alt+) , kbstyle(Win+) |
Linux | kbstyle(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:
{ "key": "enter", "command": "type",
"args": { "text": "Hello World" },
"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:
// In Default Keyboard Shortcuts
...
{ "key": "tab", "command": "tab", "when": ... },
{ "key": "tab", "command": "jumpToNextSnippetPlaceholder", "when": ... },
{ "key": "tab", "command": "acceptSelectedSuggestion", "when": ... },
...
// To remove the second rule, for example, add in keybindings.json:
{ "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)
forVK_TAB
(0x09
)kbstyle(;)
forVK_OEM_1
(0xBA
)kbstyle(=)
forVK_OEM_PLUS
(0xBB
)kbstyle(,)
forVK_OEM_COMMA
(0xBC
)kbstyle(-)
forVK_OEM_MINUS
(0xBD
)kbstyle(.)
forVK_OEM_PERIOD
(0xBE
)kbstyle(/)
forVK_OEM_2
(0xBF
)kbstyle(`)
forVK_OEM_3
(0xC0
)kbstyle([)
forVK_OEM_4
(0xDB
)kbstyle(\)
forVK_OEM_5
(0xDC
)kbstyle(])
forVK_OEM_6
(0xDD
)kbstyle(')
forVK_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+*)
:
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:
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.
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:
{ "key": "cmd+[Slash]", "command": "editor.action.commentLine",
"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:
Operator | Symbol | Example |
---|---|---|
Equality | == | “editorLangId == typescript” |
Inequality | != | “resourceExtname != .js” |
Or | </td><td></td></tr><tr><td>And</td><td><code>&&</code></td><td><code>"textInputFocus && !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 name | True when |
---|---|
Editor contexts | |
editorFocus | An editor has focus, either the text or a widget. |
editorTextFocus | The text in an editor has focus (cursor is blinking). |
textInputFocus | Any editor has focus (regular editor, debug REPL, etc.). |
inputFocus | Any text input area has focus (editors or text boxes). |
editorHasSelection | Text is selected in the editor. |
editorHasMultipleSelections | Multiple regions of text are selected (multiple cursors). |
editorReadonly | The editor is read only. |
editorLangId | True when the editor’s associated language Id matches. Example: “editorLangId == typescript” . |
isInDiffEditor | The active editor is a difference editor. |
isInEmbeddedEditor | True when the focus is inside an embedded editor. |
Operating system contexts | |
isLinux | True when the OS is Linux |
isMac | True when the OS is macOS |
isWindows | True when the OS is Windows |
isWeb | True when accessing the editor from the Web |
List contexts | |
listFocus | A list has focus. |
listSupportsMultiselect | A list supports multi select. |
listHasSelectionOrFocus | A list has selection or focus. |
listDoubleSelection | A list has a selection of 2 elements. |
listMultiSelection | A list has a selection of multiple elements. |
Mode contexts | |
inDebugMode | A debug session is running. |
debugType | True when debug type matches. Example: “debugType == ‘node’” . |
inSnippetMode | The editor is in snippet mode. |
inQuickOpen | The Quick Open drop-down has focus. |
Resource contexts | |
resourceScheme | True when the resource Uri scheme matches. Example: “resourceScheme == file” |
resourceFilename | True when the Explorer or editor filename matches. Example: “resourceFilename == gulpfile.js” |
resourceExtname | True when the Explorer or editor filename extension matches. Example: “resourceExtname == .js” |
resourceLangId | True when the Explorer or editor title language Id matches. Example: “resourceLangId == markdown” |
isFileSystemResource | True when the Explorer or editor file is a file system resource that can be handled from a file system provider |
resourceSet | True when an Explorer or editor file is set |
resource | The full Uri of the Explorer or editor file |
Explorer contexts | |
explorerViewletVisible | True if Explorer view is visible. |
explorerViewletFocus | True if Explorer view has keyboard focus. |
filesExplorerFocus | True if File Explorer section has keyboard focus. |
openEditorsFocus | True if OPEN EDITORS section has keyboard focus. |
explorerResourceIsFolder | True if a folder is selected in the Explorer. |
Editor widget contexts | |
findWidgetVisible | Editor Find widget is visible. |
suggestWidgetVisible | Suggestion widget (IntelliSense) is visible. |
suggestWidgetMultipleSuggestions | Multiple suggestions are displayed. |
renameInputVisible | Rename input text box is visible. |
referenceSearchVisible | Peek References peek window is open. |
inReferenceSearchEditor | The Peek References peek window editor has focus. |
config.editor.stablePeek | Keep peek editors open (controlled by editor.stablePeek setting). |
quickFixWidgetVisible | Quick Fix widget is visible. |
parameterHintsVisible | Parameter hints are visible (controlled by editor.parameterHints.enabled setting). |
parameterHintsMultipleSignatures | Multiple parameter hints are displayed. |
Integrated terminal contexts | |
terminalFocus | An integrated terminal has focus. |
terminalIsOpen | An integrated terminal is opened. |
Timeline view contexts | |
timelineFollowActiveEditor | True if the Timeline view is following the active editor. |
Timeline view item contexts | |
timelineItem | True when the timeline item’s context value matches. Example: “timelineItem =~ /git:file:commit\b/“ . |
Extension contexts | |
extension | True when the extension’s ID matches. Example: “extension == eamodio.gitlens” . |
extensionStatus | True when the extension is installed. Example: “extensionStatus == installed” . |
extensionHasConfiguration | True if the extension has configuration. |
Global UI contexts | |
notificationFocus | Notification has keyboard focus. |
notificationCenterVisible | Notification Center is visible at the bottom right of VS Code. |
notificationToastsVisible | Notification toast is visible at the bottom right of VS Code. |
searchViewletVisible | Search view is open. |
sideBarVisible | Side Bar is displayed. |
sideBarFocus | Side Bar has focus. |
panelFocus | Panel has focus. |
inZenMode | Window is in Zen Mode. |
isCenteredLayout | Editor is in centered layout mode. |
inDebugRepl | Focus is in the Debug Console REPL. |
workbenchState | Can be empty , folder (1 folder), or workspace . |
workspaceFolderCount | Count of workspace folders. |
replaceActive | Search view Replace text box is open. |
view | True when view identifier matches. Example: “view == myViewsExplorerID” . |
viewItem | True when viewItem context matches. Example: “viewItem == someContextValue” . |
isFullscreen | True when window is in fullscreen. |
focusedView | The identifier of the currently focused view. |
canNavigateBack | True if it is possible to navigate back. |
canNavigateForward | True if it is possible to navigate forward. |
canNavigateToLastEditLocation | True if it is possible to navigate to the last edit location. |
Global Editor UI contexts | |
textCompareEditorVisible | At least one diff (compare) editor is visible. |
textCompareEditorActive | A diff (compare) editor is active. |
editorIsOpen | True if one editor is open. |
groupActiveEditorDirty | True when the active editor in a group is dirty. |
groupEditorsCount | Number of editors in a group. |
activeEditorGroupEmpty | True if the active editor group has no editors. |
activeEditorGroupIndex | Index of the active editor in an group (beginning with 1 ). |
activeEditorGroupLast | True when the active editor in an group is the last one. |
multipleEditorGroups | True when multiple editor groups are present. |
editorPinned | True when the active editor in a group is pinned (not in preview mode). |
activeEditor | The identifier of the active editor in a group. |
Configuration settings contexts | |
config.editor.minimap.enabled | True 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 name | True when |
---|---|
activeViewlet | True when view is visible. Example: “activeViewlet == ‘workbench.view.explorer’” |
activePanel | True when panel is visible. Example: “activePanel == ‘workbench.panel.output’” |
focusedView | True 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 topanel
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:
"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:
"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:
{
"key": "ctrl+shift+r ctrl+e",
"command": "editor.action.codeAction",
"args": {
"kind": "refactor.extract.function"
}
}
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’).
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
Command | Key | Command id |
---|---|---|
Cut line (empty selection) | kb(editor.action.clipboardCutAction) | editor.action.clipboardCutAction |
Copy line (empty selection) | kb(editor.action.clipboardCopyAction) | editor.action.clipboardCopyAction |
Paste | kb(editor.action.clipboardPasteAction) | editor.action.clipboardPasteAction |
Delete Line | kb(editor.action.deleteLines) | editor.action.deleteLines |
Insert Line Below | kb(editor.action.insertLineAfter) | editor.action.insertLineAfter |
Insert Line Above | kb(editor.action.insertLineBefore) | editor.action.insertLineBefore |
Move Line Down | kb(editor.action.moveLinesDownAction) | editor.action.moveLinesDownAction |
Move Line Up | kb(editor.action.moveLinesUpAction) | editor.action.moveLinesUpAction |
Copy Line Down | kb(editor.action.copyLinesDownAction) | editor.action.copyLinesDownAction |
Copy Line Up | kb(editor.action.copyLinesUpAction) | editor.action.copyLinesUpAction |
Undo | kb(undo) | undo |
Redo | kb(redo) | redo |
Add Selection To Next Find Match | kb(editor.action.addSelectionToNextFindMatch) | editor.action.addSelectionToNextFindMatch |
Move Last Selection To Next Find Match | kb(editor.action.moveSelectionToNextFindMatch) | editor.action.moveSelectionToNextFindMatch |
Undo last cursor operation | kb(cursorUndo) | cursorUndo |
Insert cursor at end of each line selected | kb(editor.action.insertCursorAtEndOfEachLineSelected) | editor.action.insertCursorAtEndOfEachLineSelected |
Select all occurrences of current selection | kb(editor.action.selectHighlights) | editor.action.selectHighlights |
Select all occurrences of current word | kb(editor.action.changeAll) | editor.action.changeAll |
Select current line | kb(expandLineSelection) | expandLineSelection |
Insert Cursor Below | kb(editor.action.insertCursorBelow) | editor.action.insertCursorBelow |
Insert Cursor Above | kb(editor.action.insertCursorAbove) | editor.action.insertCursorAbove |
Jump to matching bracket | kb(editor.action.jumpToBracket) | editor.action.jumpToBracket |
Indent Line | kb(editor.action.indentLines) | editor.action.indentLines |
Outdent Line | kb(editor.action.outdentLines) | editor.action.outdentLines |
Go to Beginning of Line | kb(cursorHome) | cursorHome |
Go to End of Line | kb(cursorEnd) | cursorEnd |
Go to End of File | kb(cursorBottom) | cursorBottom |
Go to Beginning of File | kb(cursorTop) | cursorTop |
Scroll Line Down | kb(scrollLineDown) | scrollLineDown |
Scroll Line Up | kb(scrollLineUp) | scrollLineUp |
Scroll Page Down | kb(scrollPageDown) | scrollPageDown |
Scroll Page Up | kb(scrollPageUp) | scrollPageUp |
Fold (collapse) region | kb(editor.fold) | editor.fold |
Unfold (uncollapse) region | kb(editor.unfold) | editor.unfold |
Fold (collapse) all subregions | kb(editor.foldRecursively) | editor.foldRecursively |
Unfold (uncollapse) all subregions | kb(editor.unfoldRecursively) | editor.unfoldRecursively |
Fold (collapse) all regions | kb(editor.foldAll) | editor.foldAll |
Unfold (uncollapse) all regions | kb(editor.unfoldAll) | editor.unfoldAll |
Add Line Comment | kb(editor.action.addCommentLine) | editor.action.addCommentLine |
Remove Line Comment | kb(editor.action.removeCommentLine) | editor.action.removeCommentLine |
Toggle Line Comment | kb(editor.action.commentLine) | editor.action.commentLine |
Toggle Block Comment | kb(editor.action.blockComment) | editor.action.blockComment |
Find | kb(actions.find) | actions.find |
Replace | kb(editor.action.startFindReplaceAction) | editor.action.startFindReplaceAction |
Find Next | kb(editor.action.nextMatchFindAction) | editor.action.nextMatchFindAction |
Find Previous | kb(editor.action.previousMatchFindAction) | editor.action.previousMatchFindAction |
Select All Occurrences of Find Match | kb(editor.action.selectAllMatches) | editor.action.selectAllMatches |
Toggle Find Case Sensitive | kb(toggleFindCaseSensitive) | toggleFindCaseSensitive |
Toggle Find Regex | kb(toggleFindRegex) | toggleFindRegex |
Toggle Find Whole Word | kb(toggleFindWholeWord) | toggleFindWholeWord |
Toggle Use of Tab Key for Setting Focus | kb(editor.action.toggleTabFocusMode) | editor.action.toggleTabFocusMode |
Toggle Render Whitespace | kb(toggleRenderWhitespace) | toggleRenderWhitespace |
Toggle Word Wrap | kb(editor.action.toggleWordWrap) | editor.action.toggleWordWrap |
Rich Languages Editing
Command | Key | Command id |
---|---|---|
Trigger Suggest | kb(editor.action.triggerSuggest) | editor.action.triggerSuggest |
Trigger Parameter Hints | kb(editor.action.triggerParameterHints) | editor.action.triggerParameterHints |
Format Document | kb(editor.action.formatDocument) | editor.action.formatDocument |
Format Selection | kb(editor.action.formatSelection) | editor.action.formatSelection |
Go to Definition | kb(editor.action.revealDefinition) | editor.action.revealDefinition |
Show Hover | kb(editor.action.showHover) | editor.action.showHover |
Peek Definition | kb(editor.action.peekDefinition) | editor.action.peekDefinition |
Open Definition to the Side | kb(editor.action.revealDefinitionAside) | editor.action.revealDefinitionAside |
Quick Fix | kb(editor.action.quickFix) | editor.action.quickFix |
Go to References | kb(editor.action.goToReferences) | editor.action.goToReferences |
Rename Symbol | kb(editor.action.rename) | editor.action.rename |
Replace with Next Value | kb(editor.action.inPlaceReplace.down) | editor.action.inPlaceReplace.down |
Replace with Previous Value | kb(editor.action.inPlaceReplace.up) | editor.action.inPlaceReplace.up |
Expand AST Selection | kb(editor.action.smartSelect.expand) | editor.action.smartSelect.expand |
Shrink AST Selection | kb(editor.action.smartSelect.shrink) | editor.action.smartSelect.shrink |
Trim Trailing Whitespace | kb(editor.action.trimTrailingWhitespace) | editor.action.trimTrailingWhitespace |
Change Language Mode | kb(workbench.action.editor.changeLanguageMode) | workbench.action.editor.changeLanguageMode |
Navigation
Command | Key | Command id |
---|---|---|
Show All Symbols | kb(workbench.action.showAllSymbols) | workbench.action.showAllSymbols |
Go to Line… | kb(workbench.action.gotoLine) | workbench.action.gotoLine |
Go to File…, Quick Open | kb(workbench.action.quickOpen) | workbench.action.quickOpen |
Go to Symbol… | kb(workbench.action.gotoSymbol) | workbench.action.gotoSymbol |
Show Problems | kb(workbench.actions.view.problems) | workbench.actions.view.problems |
Go to Next Error or Warning | kb(editor.action.marker.nextInFiles) | editor.action.marker.nextInFiles |
Go to Previous Error or Warning | kb(editor.action.marker.prevInFiles) | editor.action.marker.prevInFiles |
Show All Commands | kb(workbench.action.showCommands) or kbstyle(F1) | workbench.action.showCommands |
Navigate Editor Group History | kb(workbench.action.quickOpenPreviousRecentlyUsedEditorInGroup) | workbench.action.quickOpenPreviousRecentlyUsedEditorInGroup |
Go Back | kb(workbench.action.navigateBack) | workbench.action.navigateBack |
Go back in Quick Input | kb(workbench.action.quickInputBack) | workbench.action.quickInputBack |
Go Forward | kb(workbench.action.navigateForward) | workbench.action.navigateForward |
Editor/Window Management
Command | Key | Command id |
---|---|---|
New Window | kb(workbench.action.newWindow) | workbench.action.newWindow |
Close Window | kb(workbench.action.closeWindow) | workbench.action.closeWindow |
Close Editor | kb(workbench.action.closeActiveEditor) | workbench.action.closeActiveEditor |
Close Folder | kb(workbench.action.closeFolder) | workbench.action.closeFolder |
Cycle Between Editor Groups | kb(workbench.action.navigateEditorGroups) | workbench.action.navigateEditorGroups |
Split Editor | kb(workbench.action.splitEditor) | workbench.action.splitEditor |
Focus into First Editor Group | kb(workbench.action.focusFirstEditorGroup) | workbench.action.focusFirstEditorGroup |
Focus into Second Editor Group | kb(workbench.action.focusSecondEditorGroup) | workbench.action.focusSecondEditorGroup |
Focus into Third Editor Group | kb(workbench.action.focusThirdEditorGroup) | workbench.action.focusThirdEditorGroup |
Focus into Editor Group on the Left | kb(workbench.action.focusPreviousGroup) | workbench.action.focusPreviousGroup |
Focus into Editor Group on the Right | kb(workbench.action.focusNextGroup) | workbench.action.focusNextGroup |
Move Editor Left | kb(workbench.action.moveEditorLeftInGroup) | workbench.action.moveEditorLeftInGroup |
Move Editor Right | kb(workbench.action.moveEditorRightInGroup) | workbench.action.moveEditorRightInGroup |
Move Active Editor Group Left | kb(workbench.action.moveActiveEditorGroupLeft) | workbench.action.moveActiveEditorGroupLeft |
Move Active Editor Group Right | kb(workbench.action.moveActiveEditorGroupRight) | workbench.action.moveActiveEditorGroupRight |
Move Editor into Next Group | kb(workbench.action.moveEditorToNextGroup) | workbench.action.moveEditorToNextGroup |
Move Editor into Previous Group | kb(workbench.action.moveEditorToPreviousGroup) | workbench.action.moveEditorToPreviousGroup |
File Management
Command | Key | Command id |
---|---|---|
New File | kb(workbench.action.files.newUntitledFile) | workbench.action.files.newUntitledFile |
Open File… | kb(workbench.action.files.openFile) | workbench.action.files.openFile |
Save | kb(workbench.action.files.save) | workbench.action.files.save |
Save All | kb(workbench.action.files.saveAll) | workbench.action.files.saveAll |
Save As… | kb(workbench.action.files.saveAs) | workbench.action.files.saveAs |
Close | kb(workbench.action.closeActiveEditor) | workbench.action.closeActiveEditor |
Close Others | kb(workbench.action.closeOtherEditors) | workbench.action.closeOtherEditors |
Close Group | kb(workbench.action.closeEditorsInGroup) | workbench.action.closeEditorsInGroup |
Close Other Groups | kb(workbench.action.closeEditorsInOtherGroups) | workbench.action.closeEditorsInOtherGroups |
Close Group to Left | kb(workbench.action.closeEditorsToTheLeft) | workbench.action.closeEditorsToTheLeft |
Close Group to Right | kb(workbench.action.closeEditorsToTheRight) | workbench.action.closeEditorsToTheRight |
Close All | kb(workbench.action.closeAllEditors) | workbench.action.closeAllEditors |
Reopen Closed Editor | kb(workbench.action.reopenClosedEditor) | workbench.action.reopenClosedEditor |
Keep Open | kb(workbench.action.keepEditor) | workbench.action.keepEditor |
Copy Path of Active File | kb(workbench.action.files.copyPathOfActiveFile) | workbench.action.files.copyPathOfActiveFile |
Reveal Active File in Windows | kb(workbench.action.files.revealActiveFileInWindows) | workbench.action.files.revealActiveFileInWindows |
Show Opened File in New Window | kb(workbench.action.files.showOpenedFileInNewWindow) | workbench.action.files.showOpenedFileInNewWindow |
Compare Opened File With | kb(workbench.files.action.compareFileWith) | workbench.files.action.compareFileWith |
Display
Command | Key | Command id |
---|---|---|
Toggle Full Screen | kb(workbench.action.toggleFullScreen) | workbench.action.toggleFullScreen |
Toggle Zen Mode | kb(workbench.action.toggleZenMode) | workbench.action.toggleZenMode |
Leave Zen Mode | kb(workbench.action.exitZenMode) | workbench.action.exitZenMode |
Zoom in | kb(workbench.action.zoomIn) | workbench.action.zoomIn |
Zoom out | kb(workbench.action.zoomOut) | workbench.action.zoomOut |
Reset Zoom | kb(workbench.action.zoomReset) | workbench.action.zoomReset |
Toggle Sidebar Visibility | kb(workbench.action.toggleSidebarVisibility) | workbench.action.toggleSidebarVisibility |
Show Explorer / Toggle Focus | kb(workbench.view.explorer) | workbench.view.explorer |
Show Search | kb(workbench.view.search) | workbench.view.search |
Show Source Control | kb(workbench.view.scm) | workbench.view.scm |
Show Run | kb(workbench.view.debug) | workbench.view.debug |
Show Extensions | kb(workbench.view.extensions) | workbench.view.extensions |
Show Output | kb(workbench.action.output.toggleOutput) | workbench.action.output.toggleOutput |
Quick Open View | kb(workbench.action.quickOpenView) | workbench.action.quickOpenView |
Open New Command Prompt | kb(workbench.action.terminal.openNativeConsole) | workbench.action.terminal.openNativeConsole |
Toggle Markdown Preview | kb(markdown.showPreview) | markdown.showPreview |
Open Preview to the Side | kb(markdown.showPreviewToSide) | markdown.showPreviewToSide |
Toggle Integrated Terminal | kb(workbench.action.terminal.toggleTerminal) | workbench.action.terminal.toggleTerminal |
Search
Command | Key | Command id |
---|---|---|
Show Search | kb(workbench.view.search) | workbench.view.search |
Replace in Files | kb(workbench.action.replaceInFiles) | workbench.action.replaceInFiles |
Toggle Match Case | kb(toggleSearchCaseSensitive) | toggleSearchCaseSensitive |
Toggle Match Whole Word | kb(toggleSearchWholeWord) | toggleSearchWholeWord |
Toggle Use Regular Expression | kb(toggleSearchRegex) | toggleSearchRegex |
Toggle Search Details | kb(workbench.action.search.toggleQueryDetails) | workbench.action.search.toggleQueryDetails |
Focus Next Search Result | kb(search.action.focusNextSearchResult) | search.action.focusNextSearchResult |
Focus Previous Search Result | kb(search.action.focusPreviousSearchResult) | search.action.focusPreviousSearchResult |
Show Next Search Term | kb(history.showNext) | history.showNext |
Show Previous Search Term | kb(history.showPrevious) | history.showPrevious |
Preferences
Command | Key | Command id |
---|---|---|
Open Settings | kb(workbench.action.openSettings) | workbench.action.openSettings |
Open Workspace Settings | kb(workbench.action.openWorkspaceSettings) | workbench.action.openWorkspaceSettings |
Open Keyboard Shortcuts | kb(workbench.action.openGlobalKeybindings) | workbench.action.openGlobalKeybindings |
Open User Snippets | kb(workbench.action.openSnippets) | workbench.action.openSnippets |
Select Color Theme | kb(workbench.action.selectTheme) | workbench.action.selectTheme |
Configure Display Language | kb(workbench.action.configureLocale) | workbench.action.configureLocale |
Debug
Command | Key | Command id |
---|---|---|
Toggle Breakpoint | kb(editor.debug.action.toggleBreakpoint) | editor.debug.action.toggleBreakpoint |
Start | kb(workbench.action.debug.start) | workbench.action.debug.start |
Continue | kb(workbench.action.debug.continue) | workbench.action.debug.continue |
Start (without debugging) | kb(workbench.action.debug.run) | workbench.action.debug.run |
Pause | kb(workbench.action.debug.pause) | workbench.action.debug.pause |
Step Into | kb(workbench.action.debug.stepInto) | workbench.action.debug.stepInto |
Tasks
Command | Key | Command id |
---|---|---|
Run Build Task | kb(workbench.action.tasks.build) | workbench.action.tasks.build |
Run Test Task | kb(workbench.action.tasks.test) | workbench.action.tasks.test |
Extensions
Command | Key | Command id |
---|---|---|
Install Extension | kb(workbench.extensions.action.installExtension) | workbench.extensions.action.installExtension |
Show Installed Extensions | kb(workbench.extensions.action.showInstalledExtensions) | workbench.extensions.action.showInstalledExtensions |
Show Outdated Extensions | kb(workbench.extensions.action.listOutdatedExtensions) | workbench.extensions.action.listOutdatedExtensions |
Show Recommended Extensions | kb(workbench.extensions.action.showRecommendedExtensions) | workbench.extensions.action.showRecommendedExtensions |
Show Popular Extensions | kb(workbench.extensions.action.showPopularExtensions) | workbench.extensions.action.showPopularExtensions |
Update All Extensions | kb(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.
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:
// Original, in Default Keyboard Shortcuts
{ "key": "ctrl+shift+k", "command": "editor.action.deleteLines",
"when": "editorTextFocus" },
// Modified, in User/keybindings.json, Ctrl+D now will also trigger this action
{ "key": "ctrl+d", "command": "editor.action.deleteLines",
"when": "editorTextFocus" },
How can I add a key binding for only certain file types?
Use the editorLangId
context key in your when
clause:
{ "key": "shift+alt+a", "command": "editor.action.blockComment",
"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.