93

After experimenting with my VSCode key bindings, I would like to reset them 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

wjandrea
  • 28,235
  • 9
  • 60
  • 81
hba
  • 7,406
  • 10
  • 63
  • 105

14 Answers14

101

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. Right click on the key-binding that you want to reset and choose "Reset Keybinding"
Pradeep Anchan
  • 1,469
  • 1
  • 11
  • 11
39

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.
Alexis Tyler
  • 1,394
  • 6
  • 30
  • 48
Bestin John
  • 1,765
  • 1
  • 20
  • 23
29

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.

Aldo
  • 1,199
  • 12
  • 19
  • 1
    This is no longer correct. There is now a button at the top of the window to "Open Keyboard Shortcuts (JSON)" - here you can delete all the custom bindings. – David Gilbertson May 23 '20 at 04:50
  • @DavidGilbertson deleting a custom key binding in your custom config is not the same as resetting a key binding since it is possible to unbind system shortcuts such as for example `Undo`. Removing undo does not add an empty entry into your custom settings. – DangerPaws Feb 25 '23 at 10:30
19

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

aazimkhani
  • 459
  • 5
  • 8
7

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

Nditah
  • 1,429
  • 19
  • 23
  • Thank you, you reminded me that when I started the current Java project, I was promptetd to install Eclipse keybinds, which I do NOT want. Thanks, again! – Sebastian Apr 21 '20 at 10:32
6

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
}
PatrickT
  • 10,037
  • 9
  • 76
  • 111
3

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.

George
  • 938
  • 3
  • 11
  • 34
3

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

Marline
  • 269
  • 3
  • 10
3

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.

2

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/auser/.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.

gavzo
  • 21
  • 2
0

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.

ssppjj
  • 179
  • 1
  • 10
0

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

0

If you are on a Mac, press and hold command while hitting the k and s keys. Then click the icon on the top right with the three circles and press "Show User Keybindings". Then, hit command + delete while highlighting over the keybinding you want to delete.

SamuelC00
  • 61
  • 6
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Aug 25 '22 at 07:52
0

In visual studio code, if you notice your key shortcut is having a - at the beginning, it means is disabled. Or if is dimmed is also an indicator is disabled. So to re-enable it, go to your .settings json file and remove the - from it

From this

{
    "key": "ctrl+space",
    "command": "-editor.action.triggerSuggest",
    "when": "editorHasCompletionItemProvider && textInputFocus && !editorReadonly && !suggestWidgetVisible"
  }

To this

{
    "key": "ctrl+space",
    "command": "editor.action.triggerSuggest",
    "when": "editorHasCompletionItemProvider && textInputFocus && !editorReadonly && !suggestWidgetVisible"
  },
Peter
  • 1,124
  • 14
  • 17