askvity

How to Change Keybinds in Visual Studio Code

Published in VS Code Keybindings 2 mins read

You can quickly customize keybindings for user interface actions directly within Visual Studio Code (VS Code).

Changing keybindings allows you to personalize your coding environment, making frequently used commands more accessible and aligning shortcuts with your workflow or other editors you use.

Quick Customization Method

A straightforward way to modify a shortcut for an action visible in the VS Code interface is by using the context menu:

  1. Identify the action: Find the specific command or action you want to change the keybinding for within the VS Code workbench (the main application window). This could be an item in a menu, a button, or an entry in a view.
  2. Right-click: Right-click on the action item you wish to customize.
  3. Select Customize Keybinding: From the context menu that appears, select the Customize Keybinding option.

This action will typically open the Keyboard Shortcuts editor focused on the specific command associated with the item you right-clicked. You can then easily add, change, or remove the keybinding for that command.

Automatic Context Handling

One benefit of using this method is that if the action has a when clause, it's automatically included. A when clause in VS Code keybindings specifies the context in which a shortcut is active (e.g., only when a text editor is focused, when a specific file type is open, or when a certain view is visible). By automatically including this, VS Code helps ensure your customized keybinding works in the intended situation, making it easier to set up your keybindings just the way you need them.

This right-click method provides a rapid way to jump directly to the keybinding setting for a specific UI element, streamlining the customization process. For more advanced keybinding management, you can typically access the full Keyboard Shortcuts editor via File > Preferences > Keyboard Shortcuts (or by pressing Ctrl+K Ctrl+S or Cmd+K Cmd+S).

Related Articles