简体   繁体   English

如何防止Sublime Text 3跳过括号?

[英]How to prevent Sublime Text 3 from skipping parentheses?

I am using Sublime Text 3 Build 3114 on Ubuntu 16.04 and this ST3 "feature" drives me crazy. 我在Ubuntu 16.04上使用Sublime Text 3 Build 3114而这个ST3“功能”让我发疯。

How to prevent Sublime Text 3 from skipping ending parentheses. 如何防止Sublime Text 3跳过结束括号。 You can see the behaviour in GIF below. 您可以在下面看到GIF中的行为。 In that gif I am pressing only closing paren ) . 在那个gif我只是紧迫关闭paren ) As you can see first two parens are not registered because they already exist, ST just skips existing one and draw only the paren when there is no closing paren present after the cursor. 正如你所看到的,前两个parens没有注册,因为它们已经存在,ST只是跳过现有的pare,只有当光标后没有关闭paren时才绘制paren。

Is there a setting to disable this behaviour? 是否有禁用此行为的设置?

在此输入图像描述

One possibility would be to set "auto_match_enabled": false in your user preferences. 一种可能性是在用户首选项中设置"auto_match_enabled": false This will ensure that ) always inserts a bracket. 这将确保总是插入支架。 However, it does mean that when typing a ( , it will never automatically insert a closing bracket. 但是,它确实意味着在键入( ,它永远不会自动插入一个结束括号。

If you don't want to lose this automatic pairing functionality, you can insert the following in your user keybindings file: 如果您不想丢失此自动配对功能,可以在用户keybindings文件中插入以下内容:

{ "keys": [")"], "command": "insert", "args": {"characters": ")"}, "context":
    [
        { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
        { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
        { "key": "following_text", "operator": "regex_contains", "operand": "^\\)", "match_all": true }
    ]
},

which will override the default keybinding that moves over the bracket. 这将覆盖在括号上移动的默认键绑定。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM