sublimetext3 - 在 sublime 3 中如何在括号上设置返回空间?

标签 sublimetext3 sublimetext

当我输入 action()并在括号之间点击返回,我得到这个:

action (
    )

而不是这个:
action (
)

我该如何改变?

我现在在我的键绑定(bind)中有这个,但它只适用于非 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>

这是一个临时解决方案,不是最好的。但暂时它可以工作。

关于sublimetext3 - 在 sublime 3 中如何在括号上设置返回空间?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43486799/

相关文章:

sublimetext2 - 通过 Sublime API 在侧边栏中右键单击获取文件夹路径

sublimetext3 - 崇高文本 3.2.1 : How do I get rid of these popups as I type?

sublimetext3 - Sublime Text 3 线条周围的白框

php - 正则表达式在 Sublime 3 中将 "array()"更改为 "[]"

regex - 在Sublime Text 3中使用正则表达式替换

html - Sublime Text 2 编辑器是否支持实时 HTML 和 CSS 预览?

sublimetext2 - 如何在 Sublime Text 3 中搜索特定文件类型的多个文件

sublimetext2 - Sublime Text 中是否有部分标题标记(如 XCode 的 Pragma Mark)?

error-handling - 系统找不到在SublimeText3中指定的用于lua构建的文件。我该如何解决?

regex - 将Markdown链接从内联转换为引用