Sublime Text 2 换行缩进

Sod*_*ukh 2 html text-editor editor sublimetext2

<div>
This line needs to be indented and closing div tag should be in a new line</div>

<div>
  This result is what I want
</div>
Run Code Online (Sandbox Code Playgroud)

在 Sublime Text 2 中,通过按 ctrl+shift+W 并按“enter”创建标签后,我希望结果如上。我必须安装插件还是我错过了什么?

sku*_*oda 5

认为您正在尝试与此问题相同 -在点击 Enter 以扩展 HTML 中的单行标记时自动缩进新行

下面是我的回答。


尝试在您的用户键绑定中添加以下内容。

{ "keys": ["enter"], "command": "insert_snippet", "args": {"contents": "\n\t$0\n"}, "context":
    [
        { "key": "setting.auto_indent", "operator": "equal", "operand": true },
        { "key": "selector", "operator": "equal", "operand": "meta.scope.between-tag-pair", "match_all": true },
        { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }
    ]
}
Run Code Online (Sandbox Code Playgroud)