Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 585
Warren P Avatar asked Nov 18 '15 21:11

Warren P


People also ask

How do I customize Keyboard Shortcuts in Visual Studio?

On the menu bar, choose Tools > Options. Expand Environment, and then choose Keyboard. Optional: Filter the list of commands by entering all or part of the name of the command, without spaces, in the Show commands containing box. In the list, choose the command to which you want to assign a keyboard shortcut.

How do I change my keyboard hotkeys?

To reassign a keyConnect the keyboard that you want to configure. Select the Start button, and then select Microsoft Mouse and Keyboard Center. From the displayed list of key names, select the key that you want to reassign. In the command list of the key that you want to reassign, select a command.

How do I change the terminal shortcut in Vscode?

Go to File → Preferences → Keyboard Shortcuts or just press Ctrl + k + Ctrl + s.


1 Answers

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

like image 164
Warren P Avatar answered Sep 28 '22 11:09

Warren P