且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在 Visual Studio Code 中更改键盘快捷键绑定?

更新时间:2023-01-01 12:49:54

点击文件 ->首选项 ->键盘快捷键.使用打开的选项卡编辑和查找可用的键绑定并分配它们.

Click File -> Preferences -> Keyboard shortcuts. Use the tab that opens up to edit and find available key bindings and assign them.

历史注释:在早期版本的 Visual Studio 代码中,您将单击文件 ->首选项 ->键盘快捷键,你会得到这样的 JSON keybindings.json:

Historical Note: In very early versions of visual studio code, you would Click File -> Preferences -> Keyboard shortcuts and you would get JSON like this keybindings.json:

// Place your key bindings in this file to overwrite the defaults
[
    { "key": "ctrl+o",                "command": "workbench.action.files.openFile" },
    
    { "key": "ctrl+alt+k",            "command": "bookmarks.toggle",
                                     "when": "editorTextFocus" }

]

但是现在在 2021 版本中,有一个适当的 GUI,这很好,因为 json 编辑方法容易出错且难以发现.

But now in 2021 versions, there is a proper GUI, which is great because the json editing method was error prone and hard to discover.

json 编辑器功能已移至新图标:

The json editor feature has been moved to a new icon: