如何在VS Code中向一个命令添加多个键盘快捷键?

问题描述 投票:0回答:1

如何在VS Code中为单个命令添加多个键盘快捷键?

作为示例(从注释中),ctrl + 0ctrl + 1应该都执行相同的命令/动作。因此,完全相同的快捷键可以执行相同的命令。

visual-studio-code vscode-settings
1个回答
0
投票

比方说,有2种绑定可以像这样关闭窗口:

enter image description here

假设我们要再添加一个键绑定,例如CMD + K,CMD + 1。您可以通过右键单击命令并选择复制来做到这一点:

enter image description here

然后,单击右上角的图标以打开键盘快捷键JSON。图标的页面上有弯曲的箭头:

enter image description here

您的用户定义的键绑定。将显示JSON。在其中输入:

// Place your key bindings in this file to override the defaults
[
    {
        "key": "cmd+k cmd+1",
        "command": "workbench.action.closeWindow"
    }
]

保存并关闭。

现在您将看到该操作的3个键绑定:

enter image description here

现在,尝试新的键盘绑定。

© www.soinside.com 2019 - 2024. All rights reserved.