html - Sublime Text 2 换行缩进

标签 html editor sublimetext2 text-editor

<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>

在 Sublime Text 2 中,通过按 ctrl+shift+W 并按“enter”创建标签后,我希望结果如上所示。我必须安装插件还是我缺少某些东西?

最佳答案

认为您正在尝试执行与此问题相同的操作 - Auto-indent new line when hitting enter to expand one-line tag in HTML .

以下是我的回答。


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

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

关于html - Sublime Text 2 换行缩进,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15755737/

相关文章:

java - 监听自定义 Eclipse 编辑器上的行更改事件

debugging - 最佳 XSLT 编辑器和|调试器

sublimetext2 - 在 Sublime 中,在冒号后键入 <tab> 会导致出现 'key => "value"',为什么?

javascript - 使元素溢出 iframe

html - 格式化 HTML 文档

ruby-on-rails - 如何导航到 Sublime Text 中 Ruby on Rails 方法的方法声明?

html - 为什么 "&#8203;"被注入(inject)到我的 HTML 中?

html - 响应表 : move cell to new line if table too small

html - Bootstrap 4 排序类

html - 如何使同一行中的元素出现在同一行不同的列中 - 骨架样板