How to reset Visual Studio Code key bindings?

Visual Studio-CodeVscode Settings

Visual Studio-Code Problem Overview


I have been experimenting with my vs-code key bindings.

I would like to reset the key-bindings to the original settings.

How do I do that?

I am on Linux Mint 18.

I tried removing all the records from the keybindings.json

Visual Studio-Code Solutions


Solution 1 - Visual Studio-Code

Version 1.34.0 seems to have the settings at a slightly different location:

  1. Click File > Preferences > Keyboard Shortcuts
  2. There is a triple-dot (...) at the top-right hand corner. Click on that and select "Show User Keybindings"
  3. Delete your listed keybindings

Solution 2 - Visual Studio-Code

Here are the steps to reset the keybindings in VS code.

  1. Click File > Preferences > Keyboard Shortcuts or Press Ctrl+K Ctrl+S

enter image description here

  1. Then, click on keybindings.json

enter image description here

  1. From keybindings.json remove the custom bindings you want to reset.

Solution 3 - Visual Studio-Code

It seems newer versions of VSCode (>1.33 for Mac) doesn't have a direct link to keybindings.json anymore, as this answer shows. However, there is an option to reset user defined keybindings without mess with files.

Go to the Keyboard shortcuts settings:

enter image description here

There, find the setting tagged as "User". If you click on it with the right mouse button, a context menu will show the option "Reset Keybinding":

enter image description here

This action is gonna reset the selected keybinding and tag it with "Default" again.

Solution 4 - Visual Studio-Code

first go file > preferences > keyboard shortcuts
you can see all key that you change whit click on triple-dot or put ( @source:user ) in search bar
now you can right click on which one that you want to reset and select ( reset keybinding )enter image description here

Solution 5 - Visual Studio-Code

If you had installed the Keybinding as an Extension e.g Sublime or IntelliJ IDEA Keybindings, simple go to Extension and disable or uninstall it and you would have your default keybinding.

enter image description here

Solution 6 - Visual Studio-Code

Try this documentation page about key binding in VSCode: https://code.visualstudio.com/docs/getstarted/keybindings

Open a directory that contains user settings (https://code.visualstudio.com/docs/getstarted/settings) and try to remove user key bindings file.

Solution 7 - Visual Studio-Code

Do we need another answer? Maybe not, but every year or so I find myself sifting through the information on this page, so to make it quicker next time, here are some notes:

To find the location of the settings, you can look for a button/link to the json file located somewhere in Preferences. However, I have found it easier to find the json files on my hard drive than to locate that button/link inside the app (some users report that the button/link is missing in some versions of the app). If your OS does not allow you to search through system files, open a terminal session and type $ locate keybindings.json.

If you can memorize shortcuts, a typical default shortcut that can take you to the button/link is CMD+SHIFT+P. This shortcut opens a box below the main toolbar and you can type "json" in that box to find a button/link to the json file.

General settings are in settings.json

Keyboard settings are in keybindings.json

MacOS: ~/Library/Application Support/Code/User/

Example of keybindings.json

// Place your key bindings in this file to override the defaultsauto[]
[    {        "key": "cmd+r cmd+r",        "command": "workbench.action.reloadWindow",        "when": "isDevelopment"    },    {        "key": "cmd+r",        "command": "-workbench.action.reloadWindow",        "when": "isDevelopment"    },    {        "key": "shift+cmd+c shift+cmd+c",        "command": "workbench.action.terminal.openNativeConsole",        "when": "!terminalFocus"    },    {        "key": "shift+cmd+c",        "command": "-workbench.action.terminal.openNativeConsole",        "when": "!terminalFocus"    },    {        "key": "ctrl+cmd+c",        "command": "editor.action.commentLine",        "when": "editorTextFocus && !editorReadonly"    },    {        "key": "ctrl+shift+alt+cmd+[Minus]",        "command": "-editor.action.commentLine",        "when": "editorTextFocus && !editorReadonly"    },    {        "key": "shift+cmd+c",        "command": "editor.action.blockComment",        "when": "editorTextFocus && !editorReadonly"    },    {        "key": "shift+alt+a",        "command": "-editor.action.blockComment",        "when": "editorTextFocus && !editorReadonly"    }]

Note that mapping a key combination that is already in use may result in conflicts. So the best approach is to first remap that default binding to something else. In the above, for instance, the "-" that prefixes "-editor.action.blockComment" serves to suppress the default binding. Thus, you may find that your key bindings are best set in pairs (unless your preferred combinations are sufficiently rare).

Example of settings.json

{
    "workbench.colorTheme": "Solarized Light",
    "window.zoomLevel": 4,
    "workbench.activityBar.visible": false,
    "workbench.statusBar.visible": false,
    "editor.quickSuggestions": false,
    "editor.suggest.snippetsPreventQuickSuggestions": false,
    "editor.acceptSuggestionOnCommitCharacter": false
}

Solution 8 - Visual Studio-Code

For future searchers, since this question refers to Linux, even if the keybindings.json file is moved again one can always just use locate to find it: $ locate keybindings.json.

Chances are, you will only have one, and if you have more, it will be clear where it is, as it is somewhere inside Code folder.
For example, as of today, mine is here: /home/neex/.config/Code/User/keybindings.json

Going directly to the file, will give you the opportunity to keep what you want and remove what you think might be the problematic setting.

Solution 9 - Visual Studio-Code

For the newer version of VSCode (Version: 1.43.1), you can open the keybindings.json file from the Command Palette (⇧⌘P OR Ctrl+Shift+P) with the Preferences: Open Keyboard Shortcuts (JSON) command.

Once you delete all the data in the keybindings.json file you should get rid of any changes you made to keyboard shortcuts for your installation. Everything would be set back to default.

Reason: The first line in keybindings.json file is a comment // Place your key bindings in this file to override the defaultsauto[], which means if you delete all what is there you'll get the VSCode defaults. (Ref https://code.visualstudio.com/docs/getstarted/keybindings#_advanced-customization)

You can find all information on keybindings here.

Solution 10 - Visual Studio-Code

On VS Code version 1.42.1 on Mac you can find a button that opens the Keyboard shortcuts JSON file on the top right corner of the keyboard shortcuts screen which you can open from Code -> Preferences -> Keyboard Shortcuts

enter image description here

Solution 11 - Visual Studio-Code

For VSCode Version 1.35.1, which I'm using, one can directly open the keybindings.json file using the button that looks like {} on top-right corner of "Keyboard Shortcuts" Tab's title bar:

Picture showing {} button in top-right corner

Cleaning content of this file cleans all user defined key bindings.

Solution 12 - Visual Studio-Code

In the latest version, the setting json file is with highlighted button.

I deleted everything in there and it seems to reset all keys. User setting file

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionhbaView Question on Stackoverflow
Solution 1 - Visual Studio-CodePradeep AnchanView Answer on Stackoverflow
Solution 2 - Visual Studio-CodeBestin JohnView Answer on Stackoverflow
Solution 3 - Visual Studio-CodeAldoView Answer on Stackoverflow
Solution 4 - Visual Studio-CodeaazimkhaniView Answer on Stackoverflow
Solution 5 - Visual Studio-CodeNditahView Answer on Stackoverflow
Solution 6 - Visual Studio-CodeGeorgeView Answer on Stackoverflow
Solution 7 - Visual Studio-CodePatrickTView Answer on Stackoverflow
Solution 8 - Visual Studio-CodeneexView Answer on Stackoverflow
Solution 9 - Visual Studio-CodeShailendra ShuklaView Answer on Stackoverflow
Solution 10 - Visual Studio-CodeMarlineView Answer on Stackoverflow
Solution 11 - Visual Studio-CodessppjjView Answer on Stackoverflow
Solution 12 - Visual Studio-CodeSon pronouncing 'sir-n'View Answer on Stackoverflow