从 VS Code 中删除键盘快捷键

Remove a keyboard shortcut from VS Code

我可以通过在 keybindings.json 文件中添加一个新键来覆盖 VS Code 中的任何键盘快捷键。

但是我无法删除现有的快捷方式。更具体地说,我想删除这个:

{ "key": "ctrl+alt+down",         
  "command": "editor.action.insertCursorBelow",
  "when": "editorTextFocus" }

关于如何删除它的任何想法?

用空命令覆盖它似乎可以解决问题:

{ "key": "ctrl+alt+down", "command": "",
                          "when": "editorTextFocus" }

这是covered in our documentation for keybindings。只需在命令名称前添加一个-

对于您的示例,尝试添加:

{ "key": "ctrl+alt+down", "command": "-editor.action.insertCursorBelow" }

给你的keybindings.json

如果您想知道如何在较新版本中打开此文件进行编辑:

  1. 文件 > 设置 > 键盘快捷键 K S .
  2. 单击编辑器右上角的 {} 图标。

  1. 然后按照其他答案。

使用 UI 的更简单方法:

  1. 打开 "Keyboard Shortcuts" 选项卡 ()
  2. Select 您要从快捷方式中删除的命令
  3. del 键盘

瞧! :-)

  1. 转到代码 > 首选项 > 键盘快捷键
  2. 上面应该打开屏幕截图显示的内容(所有键盘绑定的列表)
  3. 右键单击要删除的键盘绑定
  4. Select 删除键绑定

这应该删除键绑定。

事实上,在后台这也会编辑您的 keybindings.json。 要查看效果,在打开键盘快捷键后,单击具有鼠标悬停文本 Open Keyboard Shortcuts (JSON):

的图标

如果您需要更多帮助,请尝试:
https://code.visualstudio.com/docs/getstarted/keybindings#_advanced-customization

  • File>Preferences>Keyboard Shortcuts-- Ctrl+K,Ctrl+S
    (Code > Preferences > Keyboard Shortcuts -- K,S 在 macOS 上).
  • 右键单击要删除的键绑定 (Ctrl + Alt + DownArrow 在这种情况下)。
  • 点击Remove Keybinding

这会编辑您的 keybindings.json。 要查看它,请单击右上角看起来像 下面(工具提示 = Open Keyboard Shortcuts (JSON)):

如果您需要更多帮助,请尝试:
https://code.visualstudio.com/docs/getstarted/keybindings#_advanced-customization