解决 sublime Text 3 HTML标签直接按回车不插入空行

解决 sublime Text 3 HTML标签直接按回车不插入空行

一、换行光标在两个标签之间无法自动缩进的问题,如图:

解决 sublime Text 3 HTML标签直接按回车不插入空行
按回车,仅仅是单纯换行
解决 sublime Text 3 HTML标签直接按回车不插入空行
1.解决方法:打开首选项-<按键绑定-用户

解决 sublime Text 3 HTML标签直接按回车不插入空行
加入以下代码:
{ “keys”: [“enter”], “command”: “auto_indent_tag”, “context”:
[
{ “key”: “setting.auto_indent”, “operator”: “equal”, “operand”: true },
{ “key”: “selection_empty”, “operator”: “equal”, “operand”: true, “match_all”: true },
{ “key”: “selector”, “operator”: “equal”, “operand”: “punctuation.definition.tag.begin”, “match_all”: true },
{ “key”: “preceding_text”, “operator”: “regex_contains”, “operand”: “>$”, “match_all”: true },
{ “key”: “following_text”, “operator”: “regex_contains”, “operand”: “^</”, “match_all”: true },
]
}
解决 sublime Text 3 HTML标签直接按回车不插入空行
保存配置文件之后,换行就能够正常缩进了

处理tab键的缩进

和上面的一样,在用户的热键配置文件(preferences-key binding-user)中加入以下代码:
// Press the tab indent a sufficient distance
{ “keys”: [“tab”], “command”: “reindent”, “context”:
[
{ “key”: “setting.auto_indent”, “operator”: “equal”, “operand”: true },
{ “key”: “selection_empty”, “operator”: “equal”, “operand”: true, “match_all”: true },
{ “key”: “preceding_text”, “operator”: “regex_match”, “operand”: “^KaTeX parse error: Expected 'EOF', got '}' at position 22: …tch_all": true }̲, { "…”, “match_all”: true }
]
}
解决 sublime Text 3 HTML标签直接按回车不插入空行
解决 sublime Text 3 HTML标签直接按回车不插入空行
注意:一定要记得在之前的代码后面加逗号