Visual Studio Code Key Bindings
Visual Studio Code Key Bindings
Version 1.7 /updates is now available! Read about the new features and fixes in October.
Overview
TOPICS
https://github.com/Microsoft/vscodedocs/blob/master/docs/customization/keybindings.md
Visual Studio Code lets you perform most tasks directly from the keyboard. This page lists out the default bindings and describes how you can update them.
Additionally, you can install an extension to use the popular keybindings from your old editor.
Sublime Text Keymap https://marketplace.visualstudio.com/items?itemName=msvscode.sublimekeybindings Sublime Text keyboard shortcuts mapped to VS Code
commands.
Atom Keymap https://marketplace.visualstudio.com/items?itemName=msvscode.atomkeybindings Port of popular Atom keyboard shortcuts for VS Code users.
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 OS. If you need the key binding for another OS, hover your mouse over the key you are interested in.
Note: The following keys are rendered assuming a standard US keyboard layout. If you use a different keyboard layout, please read
below /docs/customization/keybindings#_keyboardlayouts.
Basic Editing
Key
Command
Command id
editor.action.clipboardCutAction
editor.action.clipboardCopyAction
Delete Line
editor.action.deleteLines
Enter
editor.action.insertLineAfter
Enter
editor.action.insertLineBefore
editor.action.moveLinesDownAction
Move Line Up
editor.action.moveLinesUpAction
editor.action.copyLinesDownAction
Copy Line Up
editor.action.copyLinesUpAction
editor.action.addSelectionToNextFindMatch
K D
editor.action.moveSelectionToNextFindMatch
cursorUndo
editor.action.insertCursorAtEndOfEachLineSelected
editor.action.selectHighlights
F2
editor.action.changeAll
expandLineSelection
editor.action.insertCursorBelow
editor.action.insertCursorAbove
editor.action.jumpToBracket
https://code.visualstudio.com/docs/customization/keybindings
1/12
11/15/2016
Key
Command
Command id
Indent Line
editor.action.indentLines
Outdent Line
editor.action.outdentLines
Home
Go to Beginning of Line
cursorHome
End
Go to End of Line
cursorEnd
Go to End of File
cursorBottom
Go to Beginning of File
cursorTop
PageDown
scrollLineDown
PageUp
Scroll Line Up
scrollLineUp
PageDown
scrollPageDown
PageUp
Scroll Page Up
scrollPageUp
editor.fold
editor.unfold
K [
editor.foldRecursively
K ]
editor.unfoldRecursively
K 0
editor.foldAll
K J
editor.unfoldAll
K C
editor.action.addCommentLine
K U
editor.action.removeCommentLine
editor.action.commentLine
editor.action.blockComment
Find
actions.find
Replace
editor.action.startFindReplaceAction
Find Next
editor.action.nextMatchFindAction
Find Previous
editor.action.previousMatchFindAction
Enter
editor.action.selectAllMatches
toggleFindCaseSensitive
toggleFindRegex
toggleFindWholeWord
editor.action.toggleTabFocusMode
unassigned
toggleRenderWhitespace
editor.action.toggleWordWrap
Command
Command id
Space
Trigger Suggest
editor.action.triggerSuggest
Space
editor.action.triggerParameterHints
Format Document
editor.action.formatDocument
K F
Format Selection
editor.action.formatSelection
F12
Go to Definition
editor.action.goToDeclaration
https://code.visualstudio.com/docs/customization/keybindings
2/12
11/15/2016
Key
Command id
F12
Peek Definition
editor.action.previewDeclaration
K F12
editor.action.openDeclarationToTheSide
Quick Fix
editor.action.quickFix
F12
Show References
editor.action.referenceSearch.trigger
F2
Rename Symbol
editor.action.rename
editor.action.inPlaceReplace.down
editor.action.inPlaceReplace.up
editor.action.smartSelect.grow
editor.action.smartSelect.shrink
K X
editor.action.trimTrailingWhitespace
K M
workbench.action.editor.changeLanguageMode
Navigation
Key
Command
Command id
workbench.action.showAllSymbols
Go to Line...
workbench.action.gotoLine
workbench.action.quickOpen
Go to Symbol...
workbench.action.gotoSymbol
Show Problems
workbench.actions.view.problems
F8
editor.action.marker.next
F8
editor.action.marker.prev
workbench.action.showCommands
Tab
workbench.action.openPreviousRecentlyUsedEditorInGroup
Go Back
workbench.action.navigateBack
Go Forward
workbench.action.navigateForward
Editor/Window Management
Key
Command
Command id
New Window
workbench.action.newWindow
Close Window
workbench.action.closeWindow
Close Editor
workbench.action.closeActiveEditor
K F
Close Folder
workbench.action.closeFolder
unassigned
workbench.action.navigateEditorGroups
Split Editor
workbench.action.splitEditor
workbench.action.focusFirstEditorGroup
workbench.action.focusSecondEditorGroup
workbench.action.focusThirdEditorGroup
workbench.action.focusPreviousGroup
workbench.action.focusNextGroup
https://code.visualstudio.com/docs/customization/keybindings
3/12
11/15/2016
Key
Command id
workbench.action.moveEditorLeftInGroup
workbench.action.moveEditorRightInGroup
workbench.action.moveActiveEditorGroupLeft
workbench.action.moveActiveEditorGroupRight
File Management
Key
Command
Command id
New File
workbench.action.files.newUntitledFile
unassigned
Open File...
workbench.action.files.openFile
Save
workbench.action.files.save
Save All
workbench.action.files.saveAll
Save As...
workbench.action.files.saveAs
Close
workbench.action.closeActiveEditor
Close Others
workbench.action.closeOtherEditors
K W
Close Group
workbench.action.closeEditorsInGroup
unassigned
workbench.action.closeEditorsInOtherGroups
unassigned
workbench.action.closeEditorsToTheLeft
unassigned
workbench.action.closeEditorsToTheRight
K W
Close All
workbench.action.closeAllEditors
workbench.action.reopenClosedEditor
K Enter
Keep Open
workbench.action.keepEditor
Tab
Open Next
workbench.action.openNextRecentlyUsedEditorInGroup
Tab
Open Previous
workbench.action.openPreviousRecentlyUsedEditorInGroup
K P
workbench.action.files.copyPathOfActiveFile
K R
workbench.action.files.revealActiveFileInWindows
K O
workbench.action.files.showOpenedFileInNewWindow
unassigned
workbench.files.action.compareFileWith
Display
Key
Command
Command id
workbench.action.toggleFullScreen
Zoom in
workbench.action.zoomIn
Zoom out
workbench.action.zoomOut
unassigned
Reset Zoom
workbench.action.zoomReset
workbench.action.toggleSidebarVisibility
Show Debug
workbench.view.debug
workbench.view.explorer
Show Git
workbench.view.git
Show Search
workbench.view.search
https://code.visualstudio.com/docs/customization/keybindings
4/12
11/15/2016
Key
Command id
Replace in Files
workbench.action.replaceInFiles
Show Extensions
workbench.view.extensions
workbench.action.search.toggleQueryDetails
workbench.action.terminal.openNativeConsole
Show Output
workbench.action.output.toggleOutput
markdown.showPreview
K V
markdown.showPreviewToSide
workbench.action.terminal.toggleTerminal
Preferences
Key
Command
Command id
workbench.action.openGlobalSettings
unassigned
workbench.action.openWorkspaceSettings
unassigned
workbench.action.openGlobalKeybindings
unassigned
workbench.action.openSnippets
unassigned
workbench.action.selectTheme
unassigned
workbench.action.configureLocale
Debug
Key
Command
Command id
F9
Toggle Breakpoint
editor.debug.action.toggleBreakpoint
F5
Continue
workbench.action.debug.continue
F5
Pause
workbench.action.debug.start
F11
Step Into
workbench.action.debug.stepInto
F11
Step Out
workbench.action.debug.stepOut
F10
Step Over
workbench.action.debug.stepOver
F5
Stop
workbench.action.debug.stop
K I
Show Hover
editor.action.showHover
Tasks
Key
Command
Command id
workbench.action.tasks.build
unassigned
workbench.action.tasks.test
Extensions
Key
Command
Command id
unassigned
Install Extension
workbench.extensions.action.installExtension
unassigned
workbench.extensions.action.showInstalledExtensions
unassigned
workbench.extensions.action.listOutdatedExtensions
unassigned
workbench.extensions.action.showRecommendedExtensions
https://code.visualstudio.com/docs/customization/keybindings
5/12
11/15/2016
Key
Command id
unassigned
workbench.extensions.action.showPopularExtensions
unassigned
workbench.extensions.action.updateAllExtensions
Customizing Shortcuts
All keyboard shortcuts in VS Code can be customized via the User/keybindings.json file.
To configure keyboard shortcuts the way you want, go to the menu under File > Preferences > Keyboard Shortcuts. Code > Preferences > Keyboard Shortcuts on Mac
This will open the Default Keyboard Shortcuts on the left and your User/keybindings.json file where you can overwrite the default bindings on the right.
The list above isn't exhaustive. More commands may be listed under "Here are other available commands" in Default Keyboard Shortcuts .
Keyboard Rules
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",
{ "key": "shift+home",
"command": "cursorHomeSelect",
"when": "editorTextFocus" },
"when": "editorTextFocus" },
"command": "actions.find" },
"command": "workbench.action.navigateBack" },
"command": "workbench.action.navigateForward" },
Accepted keys
The key is made up of modifiers and the key itself.
The following modifiers are accepted:
Platform
Modifiers
Mac
Windows
Linux
6/12
11/15/2016
True when
Editor contexts
editorFocus
editorTextFocus
editorHasSelection
editorHasMultipleSelections
editorReadOnly
editorLangId
True when the editor's associated language Id matches. Example: "editorLangId == typescript" .
Mode contexts
inDebugMode
inSnippetMode
inQuickOpen
suggestWidgetVisible
suggestWidgetMultipleSuggestions
renameInputVisible
referenceSearchVisible
inReferenceSearchEditor
config.editor.stablePeek
quickFixWidgetVisible
parameterHintsVisible
parameterHintsMultipleSignatures
Global UI contexts
resourceLangId
True when the Explorer or editor title language Id matches. Example: "resourceLangId == markdown"
globalMessageVisible
searchViewletVisible
replaceActive
The list above isn't exhaustive and you may see some when contexts for specific VS Code UI in the Default Keyboard Shortcuts .
https://code.visualstudio.com/docs/customization/keybindings
7/12
11/15/2016
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: https://msdn.microsoft.com/enus/library/windows/desktop/dd375731v=vs.85
tab for VK_TAB 0x09
; for VK_OEM_1 0xBA
= for VK_OEM_PLUS 0xBB
, for VK_OEM_COMMA 0xBC
- for VK_OEM_MINUS 0xBD
. for VK_OEM_PERIOD 0xBE
/ for VK_OEM_2 0xBF
` for VK_OEM_3 0xC0
[ for VK_OEM_4 0xDB
\ for VK_OEM_5 0xDC
] for VK_OEM_6 0xDD
' 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 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 which need pressing keys with different labels under the current system's keyboard layout. For example, here is how the Default keybindings rules
look like when using a French France keyboard layout:
https://code.visualstudio.com/docs/customization/keybindings
8/12
11/15/2016
There is also a widget that helps input the key binding rule when editing keybindings.json . To launch the Define Keybinding widget, press K K . 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 Enter and a rule snippet will be inserted.
Note: Visual Studio Code detects your current keyboard layout on startup and then caches this information. For a good experience,
we recommend restarting VS Code if you change your keyboard layout.
Next Steps
Now that you know about our Key binding support, what's next...
Customization /docs/customization/overview Configure Code the way you want Themes, Settings and more
Language Support /docs/languages/overview Our Good, Better, Best language grid to see what you can expect
Debugging /docs/editor/debugging This is where VS Code really shines
Node.js /docs/runtimes/nodejs End to end Node.js scenario with a sample app
Common Questions
Q: How to find out what command is bound to a specific key?
A: In the Default Keyboard Shortcuts, open Quick Outline by pressing O
https://code.visualstudio.com/docs/customization/keybindings
9/12
11/15/2016
Q: How to add a key binding to an action? E.g. Add Ctrl+D to Delete Lines
A: Find a rule that triggers the action in the Default Keyboard Shortcuts and write a modified version of it in your User/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" },
Q: How can I add a key binding for only certain file types?
A: Use the editorLangId context key in your when clause:
{ "key": "shift+alt+a",
"command": "editor.action.blockComment",
"when": "editorTextFocus && editorLangId == csharp" },
No
Follow @code
59.6K followers
Star
19,557
Support https://support.microsoft.com/enus/assistedsupportproducts
Privacy http://www.microsoft.com/privacystatement/enus/core/default.aspx
Terms of Use http://www.microsoft.com/enus/legal/intellectualproperty/copyright/default.aspx
License /License
http://www.microsoft.com
2016 Microsoft
https://code.visualstudio.com/docs/customization/keybindings
10/12
11/15/2016
https://code.visualstudio.com/docs/customization/keybindings
11/12
11/15/2016
https://code.visualstudio.com/docs/customization/keybindings
12/12