当我点击一个新的行按钮时,Sublime Text有3种方法来处理括号缩进.
支架
xxx = {
|cursor|
}
Run Code Online (Sandbox Code Playgroud)
2.parenthesis
xxx = (
|cursor|)
Run Code Online (Sandbox Code Playgroud)
3.方括号
xxx = [
|cursor|]
Run Code Online (Sandbox Code Playgroud)
我怎么能把它们全部设置成像花括号一样
Kei*_*all 10
在默认键绑定中,有以下内容:
{ "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 }
]
},
Run Code Online (Sandbox Code Playgroud)
它提供了Enter在支撑{和}支撑之间按压的功能.宏添加了2个换行符,将光标移动到第一个换行符之后并重新连接该行.
因此,您可以实现的相同的功能(和)和[和]加给你的用户键绑定:
{ "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 }
]
},
{ "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 }
]
},
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
808 次 |
| 最近记录: |