简体   繁体   中英

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.

How to prevent Sublime Text 3 from skipping ending parentheses. You can see the behaviour in GIF below. In that gif I am pressing only closing 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.

Is there a setting to disable this behaviour?

在此输入图像描述

One possibility would be to set "auto_match_enabled": false in your user preferences. 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:

{ "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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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