在尝试了一些VSCode的按键绑定后,
我想将它们重置为原始设置。
我该如何做呢?
我使用的是Linux Mint 18。
我尝试删除了keybindings.json中的所有记录。
我使用的是Linux Mint 18。
我尝试删除了keybindings.json中的所有记录。
版本1.34.0似乎将设置放在稍微不同的位置:
C:\Users\<yourname>\AppData\Roaming\Code\User\keybindings.json
中自行导航到 JSON 文件。 - Earlee看起来更新的 VSCode (>1.33 for Mac) 不再有直接链接到 keybindings.json
的方式,就像这个回答 显示 的那样。不过,有一种选项可以在不破坏文件的情况下重置用户定义的按键绑定。
前往键盘快捷键设置:
在那里,找到标记为“User”的设置。如果你用鼠标右键单击它,一个上下文菜单将显示出“重置按键绑定”的选项:
这个操作会重置所选的按键绑定并再次标记为“Default”。
我们需要另一个答案吗?也许不需要,但每年左右我发现自己在这个页面上筛选信息,为了下次更快捷地查找,这里有一些笔记:
要找到设置的位置,您可以在“首选项”中找到指向json文件的按钮/链接。但是,我发现在我的硬盘上找到json文件比在应用程序内定位那个按钮/链接更容易(有些用户报告称在某些版本的应用程序中缺少该按钮/链接)。如果您的操作系统不允许您搜索系统文件,请打开终端会话并键入$locate keybindings.json
。
如果您能记住快捷键,一个典型的默认快捷键是CMD+SHIFT+P。此快捷键将在主工具栏下方打开一个框,您可以在其中键入“json”以查找指向json文件的按钮/链接。
常规设置在settings.json
中。
键盘设置在keybindings.json
中。
MacOS:~/Library/Application Support/Code/User/
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"
}
]
{
"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
}
⇧⌘P
或 Ctrl+Shift+P
)使用Preference: Open Keyboard Shortcuts (JSON)命令打开keybindings.json
文件。keybindings.json
文件中的所有数据,您将消除任何对安装的键盘快捷键所做的更改。一切都会恢复为默认设置。keybindings.json
文件中的第一行是注释// Place your key bindings in this file to override the defaultsauto[]
,这意味着如果您删除其中的所有内容,则会获得VSCode的默认设置。(参考https://code.visualstudio.com/docs/getstarted/keybindings#_advanced-customization)$ locate keybindings.json
。Code
文件夹内的某个位置。
例如,截至今天,我的文件位于此处:/home/auser/.config/Code/User/keybindings.json
直接进入文件,将为您提供保留所需内容和删除可能存在问题设置的机会。