sublime 3 括号里的 return space 怎么设置?
How do you set the return space on the parentheses in sublime 3?
当我输入 action()
并在括号之间点击 return 时,我得到:
action (
)
而不是这个:
action (
)
我该如何更改?
我现在的键绑定中有这个,但它只适用于非 js 文件-
[
{ "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 }
]
},
{ "keys": ["super+shift+\"], "command": "reveal_in_side_bar"},
{"keys": ["tab"], "command": "expand_abbreviation_by_tab", "context":
[
{ "operand": "source.js", "operator": "equal", "match_all": true, "key": "selector" },
{ "match_all": true, "key": "selection_empty" },
{ "operator": "equal", "operand": false, "match_all": true, "key": "has_next_field" },
{ "operand": false, "operator": "equal", "match_all": true, "key": "auto_complete_visible" },
{ "match_all": true, "key": "is_abbreviation" }
]
},
]
如果没有解决问题,那么您可以像这样在 sublime 中为自己编写一个代码片段(菜单栏 -> 工具 -> 开发人员 -> 新代码片段)并放入以下代码并保存。
<snippet>
<content><![CDATA[
action(${1:}
)
]]></content>
<tabTrigger>act</tabTrigger>
<!-- <scope>source.JavaScript</scope> -->
</snippet>
这是一个临时解决方案,不是最好的解决方案。不过暂时还可以。
我让它工作的方法是,在 ST3 的 *.js 文件中,单击 Preferences > Settings - Syntax Specific
。应该会打开一个单独的 window,其中包含 2 个窗格。在右侧窗格中添加
"auto_indent": false,
在大括号之间并保存。当您返回 JavaScript 文件并键入 action()
并在括号之间点击 return 时,应该不会再缩进了。
当我输入 action()
并在括号之间点击 return 时,我得到:
action (
)
而不是这个:
action (
)
我该如何更改?
我现在的键绑定中有这个,但它只适用于非 js 文件-
[
{ "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 }
]
},
{ "keys": ["super+shift+\"], "command": "reveal_in_side_bar"},
{"keys": ["tab"], "command": "expand_abbreviation_by_tab", "context":
[
{ "operand": "source.js", "operator": "equal", "match_all": true, "key": "selector" },
{ "match_all": true, "key": "selection_empty" },
{ "operator": "equal", "operand": false, "match_all": true, "key": "has_next_field" },
{ "operand": false, "operator": "equal", "match_all": true, "key": "auto_complete_visible" },
{ "match_all": true, "key": "is_abbreviation" }
]
},
]
如果没有解决问题,那么您可以像这样在 sublime 中为自己编写一个代码片段(菜单栏 -> 工具 -> 开发人员 -> 新代码片段)并放入以下代码并保存。
<snippet>
<content><![CDATA[
action(${1:}
)
]]></content>
<tabTrigger>act</tabTrigger>
<!-- <scope>source.JavaScript</scope> -->
</snippet>
这是一个临时解决方案,不是最好的解决方案。不过暂时还可以。
我让它工作的方法是,在 ST3 的 *.js 文件中,单击 Preferences > Settings - Syntax Specific
。应该会打开一个单独的 window,其中包含 2 个窗格。在右侧窗格中添加
"auto_indent": false,
在大括号之间并保存。当您返回 JavaScript 文件并键入 action()
并在括号之间点击 return 时,应该不会再缩进了。