是否有“仅使用 Tab 或 Enter 提交"?Visual Studio Code 中的选项? [英] Is there the "Only use Tab or Enter to commit" option in Visual Studio Code?

查看:29
本文介绍了是否有“仅使用 Tab 或 Enter 提交"?Visual Studio Code 中的选项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Visual Studio Code 中是否有仅使用 Tab 或 Enter 提交"选项?

Is there the "Only use Tab or Enter to commit" option in Visual Studio Code?

如果是,如何取消选中此选项?

If yes, how to uncheck this option?

推荐答案

浏览默认的 keybindings.json 文件后,我想我们可以配置这个.

After browsing the default keybindings.json file, I think we can configure this.

首先,从 File > Preferences > Keyboard Shortcuts 调出按键绑定设置文件.

First, bring up the key bindings settings file from File > Preferences > Keyboard Shortcuts.

然后在右侧粘贴以下代码:

Then on the right hand side, paste the following code:

// Place your key bindings in this file to overwrite the defaults
[
    {
        "key": "shift+9", // (
        "command": "^acceptSelectedSuggestion",
        "when": "editorTextFocus && suggestWidgetVisible && suggestionSupportsAcceptOnKey"
    },
    {
        "key": "shift+0", // )
        "command": "^acceptSelectedSuggestion",
        "when": "editorTextFocus && suggestWidgetVisible && suggestionSupportsAcceptOnKey"
    },
    {
        "key": "shift+,", // <
        "command": "^acceptSelectedSuggestion",
        "when": "editorTextFocus && suggestWidgetVisible && suggestionSupportsAcceptOnKey"
    },
    {
        "key": "shift+.", // >
        "command": "^acceptSelectedSuggestion",
        "when": "editorTextFocus && suggestWidgetVisible && suggestionSupportsAcceptOnKey"
    },
    {
        "key": "[",
        "command": "^acceptSelectedSuggestion",
        "when": "editorTextFocus && suggestWidgetVisible && suggestionSupportsAcceptOnKey"
    },
    {
        "key": "]",
        "command": "^acceptSelectedSuggestion",
        "when": "editorTextFocus && suggestWidgetVisible && suggestionSupportsAcceptOnKey"
    },
    {
        "key": "space",
        "command": "^acceptSelectedSuggestion",
        "when": "editorTextFocus && suggestWidgetVisible && suggestionSupportsAcceptOnKey"
    },
    {
        "key": ",",
        "command": "^acceptSelectedSuggestion",
        "when": "editorTextFocus && suggestWidgetVisible && suggestionSupportsAcceptOnKey"
    },
    {
        "key": "shift+;", // :
        "command": "^acceptSelectedSuggestion",
        "when": "editorTextFocus && suggestWidgetVisible && suggestionSupportsAcceptOnKey"
    },
    {
        "key": "shift+/", // ?
        "command": "^acceptSelectedSuggestion",
        "when": "editorTextFocus && suggestWidgetVisible && suggestionSupportsAcceptOnKey"
    },
    {
        "key": ";",
        "command": "^acceptSelectedSuggestion",
        "when": "editorTextFocus && suggestWidgetVisible && suggestionSupportsAcceptOnKey"
    },
    {
        "key": "=",
        "command": "^acceptSelectedSuggestion",
        "when": "editorTextFocus && suggestWidgetVisible && suggestionSupportsAcceptOnKey"
    },
    {
        "key": "numpad_add", // + 
        "command": "^acceptSelectedSuggestion",
        "when": "editorTextFocus && suggestWidgetVisible && suggestionSupportsAcceptOnKey"
    },
    {
        "key": "shift+=", // + 
        "command": "^acceptSelectedSuggestion",
        "when": "editorTextFocus && suggestWidgetVisible && suggestionSupportsAcceptOnKey"
    },
    {
        "key": "shift+8", // *
        "command": "^acceptSelectedSuggestion",
        "when": "editorTextFocus && suggestWidgetVisible && suggestionSupportsAcceptOnKey"
    },
    {
        "key": "numpad_multiply", // *
        "command": "^acceptSelectedSuggestion",
        "when": "editorTextFocus && suggestWidgetVisible && suggestionSupportsAcceptOnKey"
    },
    {
        "key": "-", // -
        "command": "^acceptSelectedSuggestion",
        "when": "editorTextFocus && suggestWidgetVisible && suggestionSupportsAcceptOnKey"
    },
    {
        "key": "numpad_subtract", // -
        "command": "^acceptSelectedSuggestion",
        "when": "editorTextFocus && suggestWidgetVisible && suggestionSupportsAcceptOnKey"
    },
    {
        "key": "/", // /
        "command": "^acceptSelectedSuggestion",
        "when": "editorTextFocus && suggestWidgetVisible && suggestionSupportsAcceptOnKey"
    },
    {
        "key": "numpad_divide", // /
        "command": "^acceptSelectedSuggestion",
        "when": "editorTextFocus && suggestWidgetVisible && suggestionSupportsAcceptOnKey"
    },
    {
        "key": "shift+7", // &
        "command": "^acceptSelectedSuggestion",
        "when": "editorTextFocus && suggestWidgetVisible && suggestionSupportsAcceptOnKey"
    },
    {
        "key": "shift+\\", // |
        "command": "^acceptSelectedSuggestion",
        "when": "editorTextFocus && suggestWidgetVisible && suggestionSupportsAcceptOnKey"
    }
]

保存文件,键绑定应该立即生效.

Save the file and the key bindings should be in effect immediately.

如果您愿意,您可以添加更多提交字符,只需遵循模式即可.

You can add more commit characters if you wish, just follow the pattern.

这篇关于是否有“仅使用 Tab 或 Enter 提交"?Visual Studio Code 中的选项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆