gpt4 book ai didi

sublimetext3 - 如何在 ST3 中设置括号缩进行为

转载 作者:行者123 更新时间:2023-12-04 11:02:02 25 4
gpt4 key购买 nike

当我点击换行按钮时,Sublime Text 有 3 种方法来处理括号缩进。

1.大括号

xxx = {
|cursor|
}

2.括号
xxx = (
|cursor|)

3.方括号
xxx = [
|cursor|]

我怎么能把它们都设置成大括号

最佳答案

在默认键绑定(bind)中,有这样的:

{ "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 }
]
},

它提供了在 { 之间按 Enter 的功能和 }大括号。该宏添加 2 个换行符,将光标移动到第一个换行符之后并重新缩进该行。

因此,您可以在 ( 之间实现相同的功能。和 )[]通过将此添加到您的用户键绑定(bind):
{ "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 }
]
},

关于sublimetext3 - 如何在 ST3 中设置括号缩进行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41456641/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com