How can I change keyboard shortcut bindings in Visual Studio Code?

On Windows:

  • go to File -> Preferences -> Keyboard shortcuts,
  • or press Ctrl+K, then Ctrl+S,
  • or edit %UserProfile%\AppData\Roaming\Code\User\keybindings.json file

On Mac:

  • go to Code -> Preferences -> Keyboard shortcuts,
  • or press Cmd+K, then Cmd+S

Keep in mind you can type things like shift ctrl c in the Search input in Keyboard Shortcuts panel to find commands by their keybindings.

Here you can find documentation which among other stuff contains also information about what When conditions you can use.


The way to open the JSON file changed yet again in a recent version.

You need to click the middle of the three buttons in the tab bar.

enter image description here

You only need to do that if the change you need isn't possible on the normal settings screen.


If you want to change the advance settings of keyboard shortcut such as when then you can follow these steps:

Update:(Thanks @phdoerfler for pointing it out that icon has changed)

File->Preferences->Keyboard Shortcuts Click on icon on top right corner that says "Open Keyboard Shortcuts(JSON)" to open JSON version and place the keybinding.

Image showing icon

You can find this in Documentation here.


Click File -> Preferences -> Keyboard shortcuts. Use the tab that opens up to edit and find available key bindings and assign them. enter image description here

Historical Note: In very early versions of visual studio code, you would Click File -> Preferences -> Keyboard shortcuts and you would get JSON like this keybindings.json:

// Place your key bindings in this file to overwrite the defaults
[
    { "key": "ctrl+o",                "command": "workbench.action.files.openFile" },
    
    { "key": "ctrl+alt+k",            "command": "bookmarks.toggle",
                                     "when": "editorTextFocus" }

]

But now in 2021 versions, there is a proper GUI, which is great because the json editing method was error prone and hard to discover.

The json editor feature has been moved to a new icon:

enter image description here