选择首选项 -> 快捷键设置
出现下面编辑页
在右边添加下面一些设置(记得要用逗号与前面内容分开):
{ "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": "^$", "match_all": true },
{ "key": "following_text", "operator": "regex_match", "operand": "^$", "match_all": true }
]
},
{ "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", "punctuation.definition.tag.begin": true, "match_all": true },
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^$", "match_all": true },
{ "key": "following_text", "operator": "regex_contains", "operand": "^</", "match_all": true }
]
}
保存即可。
参考:https://mp.csdn.net/console/editor/html/107604207
https://mp.csdn.net/console/editor/html/107604207
我是结合两篇文章的,单独任一篇文章都解决不了我的问题。