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

Using Visual Studio Code what is the procedure to:

  • Remap a built in command's keyboard shortcut. For example, say, Open File (default is Ctrl+O, it's unlikely that anyone would actually change this, but the same process should probably apply for any built in shortcut).

  • Remap an extension command's keyboard shortcut, say the Bookmark extension's toggle-bookmark (default Ctrl+Alt+K)

IN 2015, this involved editing configuration JSON files, but I don't know which one, or how. In 2021 there's a new UI, how do I find it?


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


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.


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.