Sublime has this behaviour which is really annoying sometimes when you have to type in constructions with lots of brackets. When you type (
it adds ()
and puts the cursor in the middle, all fine, if you however will type )
it will silently swallow the closing bracket.
This is really annoying when typing long regexps because the brackets gets unbalanced pretty quick and this is driving me crazy. So you end up with constructions like (([a-z])
.
So the question is - is there a way to disable this? If I type a closing bracket I want it to stay, not be swallowed.
I have checked through Sublime configs, googled, but nobody seems to mind this behaviour. Am I using it wrong?
Update
You might want to check out Sublime: Jump out of matching brackets shortcut as well.
Full version that allows you to type through with ()
but will not swallow the closing symbol if you have entered any text:
{ "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 },
{ "key": "preceding_text", "operator": "regex_contains", "operand": "[^\"]$", "match_all": true }
]
},
{ "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 },
{ "key": "preceding_text", "operator": "regex_contains", "operand": "[^(]$", "match_all": true }
]
},
{ "keys": [")"], "command": "move", "args": {"by": "characters", "forward": true}, "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 },
{ "key": "preceding_text", "operator": "regex_contains", "operand": "\\($", "match_all": true }
]
},
{ "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 },
{ "key": "preceding_text", "operator": "regex_contains", "operand": "'$", "match_all": true }
]
},
{ "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 },
{ "key": "preceding_text", "operator": "regex_contains", "operand": "[$", "match_all": true }
]
},
{ "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 },
{ "key": "preceding_text", "operator": "regex_contains", "operand": "{$", "match_all": true }
]
}