Reset Keyboard Shortcut Bindings in Visual Studio Code


πŸ‘€Β Diwas Poudel Β Β  πŸ•’ 10 Sep 2023 Β Β  πŸ“ TECH

Keybindings, also known as keyboard shortcuts, are combinations of keys on your keyboard that, when pressed together, perform specific actions. For example, pressing Ctrl + Shift + F will open search, where you can search for items that are already open in VSCode.

VS Code Keyboard Shortcuts are extremely useful because they allow us to perform tasks more quickly and efficiently while writing code. You can customize your shortcut keys in Visual Studio Code to perform most tasks directly from the keyboard. It is possible that you have made unnecessary changes to the visual studio code shortcuts.

πŸ“‘ Please keep in mind that resetting Keyboard Binding in VS Code will remove all shortcut keys that are currently assigned to different tasks. This action cannot be reversed, so make certain that you want to remove these before proceeding. If you have any doubts, you can also reassign keyboard shortcuts and individually assign shortcuts.

Β How to reset individual keybindings in Visual Studio Code?

When multiple commands exist for the same keybinding or you have made unnecessary changes to it, we like to reset keybindings to default, and here are the steps for resetting individual keybinding to default.

1 Open Visual Studio Code

2 Goto File > Preferences > Keyboard Shortcuts for Windows. ( Code > Preferences >Keyboard Shortcuts for macOS).

keyboard-settings
fig.Β  Keyboard Shortcuts

This will bring up the Keyboard Shortcuts editor. Using the Keyboard Shortcuts editor, Visual Studio Code provides a rich and simple keyboard shortcuts editing experience. This will give you a comprehensive list of your vscode keyboard shortcuts.

We are interested in the keybindings settings that we created and would like to reset them. So proceed to step 3.

3 Stay in the same Keyboard Shortcuts window and look for three vertical dots in the upper right corner, then click on them.

4 Then select "Show User Keybindings."

show-user-keybindings
fig. Show User Keybindings

This will display a list of user-defined keybindings.

5 Right-click each item and select "Reset keybinding."

reset-keybinding-option
fig. Reset Keybinding

How to reset all keybindings in Visual Studio Code?

You can reset all keybindings by selecting each user's assigned keybinding one by one and clicking "Reset keybinding" or all at a time with the following steps.

In this step, we delete everything from the keybindings.json files. This will reset your vscode user-defined settings.

This will be useful if you have created a large number of keyboard shortcuts and want to delete them all at once.

1 Press theΒ Ctrl + Shift + P keyboard shortcut and this will open the Command Palette. There type Open Keyboard Shortcuts (JSON) and select it from the list. This will open keybindings.json.

open-settings-json using command palette
fig. open keybindings.json from Command Palette

2 Simply remove everything from keybindings.json and type empty [ ] into it.

keybindings-json-file
fig. Reset Keybindings.json

3 Save it. Close VSCode and reopen it, and your keybindings will be restored.Β 

We can directly navigate to the file location and delete everything from the keybindings.json and here is the location for this file.

In macOS: ~/Library/Application Support/Code/User/keybindings.json

In Windows: %UserProfile%/AppData/Roaming/Code/User/keybindings.json

In Linux: HOME/.config/Code/User/keybindings.json

If you want to learn more about VSCODE keyboard binding then visit this link:https://code.visualstudio.com/docs/getstarted/keybindings

FAQ:

What is keybindings.json?

Ans: It is a configuration file that contains keyboard shortcuts in Visual Studio Code. It contains a list of rules, each of which defines keyboard shortcuts and commands that it triggers.

Β