Answer the question
In order to leave comments, you need to log in
How to make proper bracket alignment in Sublime text 3 after "Enter" is pressed?
When you open "{" the bracket is automatically closed, and if you press enter, there will be a nice alignment.
If you do the same for "(", then you get garbage
. For "[" no indented newline is created.
How can I make sure that after closing ")" or "]" exactly the same alignment works as for "}"?
To get this kind of result.
Answer the question
In order to leave comments, you need to log in
In fact, everything is simple.
In the Key Bindings settings there is such an option
{ "keys": ["enter"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Add Line in Braces.sublime-macro"}, "context":
[
{ "key": "setting.auto_indent", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
{ "key": "preceding_text", "operator": "regex_contains", "operand": "\\{$", "match_all": true },
{ "key": "following_text", "operator": "regex_contains", "operand": "^\\}", "match_all": true }
]
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question