How to reset Visual Studio Code key bindings?
Asked Answered
H

14

111

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

Hence answered 16/3, 2018 at 4:58 Comment(0)
M
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.

Michell answered 16/3, 2018 at 5:6 Comment(1)
Yes I've seen that - it says it is easy to reset, but doesn't say howHence
P
127

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"
Pemphigus answered 28/5, 2019 at 12:47 Comment(3)
Perfect thank you i wanted to only reset one, that did the tricksBelsky
This may have worked in the past but in the current version, removing personal key bindings does not reset your key bindings, it only removes your personal key bindings.Runthrough
@Runthrough - thanks. I have updated the instructions based on your comment.Pemphigus
B
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.
Bennie answered 8/7, 2018 at 13:43 Comment(4)
This link is no longer available in VSCode. Instead, you need to click the ... menu to the top right and select "show user keybindings" then reset one by one.Grisons
The link is now an icon in the tab bar.Nw
This screen can also be found by pressing Ctrl/Cmd+Shift+P and typing "Preferences: Open keyboard shortcuts (JSON)"Embolden
You can navigate to the JSON file yourself in C:\Users\<yourname>\AppData\Roaming\Code\User\keybindings.json.Sitra
B
30

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.

Bazan answered 23/4, 2019 at 17:31 Comment(2)
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.Nw
@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.Runthrough
S
20

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

Sokotra answered 15/9, 2019 at 19:7 Comment(0)
A
8

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

Averell answered 15/1, 2020 at 7:3 Comment(1)
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!Zincograph
P
8

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
}
Papain answered 8/6, 2020 at 8:21 Comment(0)
H
4

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.

Heim answered 20/3, 2020 at 20:23 Comment(0)
M
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.

Michell answered 16/3, 2018 at 5:6 Comment(1)
Yes I've seen that - it says it is easy to reset, but doesn't say howHence
I
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

Import answered 4/3, 2020 at 1:0 Comment(0)
B
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.

Bold answered 8/1, 2020 at 17:25 Comment(0)
A
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.

Antlion answered 17/6, 2019 at 21:32 Comment(0)
A
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

Annecy answered 21/1, 2022 at 15:18 Comment(0)
R
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.

Reinke answered 19/8, 2022 at 0:37 Comment(1)
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.Pointillism
D
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"
  },
Debauchery answered 25/5, 2023 at 5:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.