问题描述
我在Sublime Text 3上编写HTML代码时遇到问题。我只想设置HTML的自动缩进格式。例如,当我像编码一样编写p标记时,缩进就像这样工作。
< p>
Hello world!
< / p>
但是我想写下代码而不是上面。
< p>
Hello world!
< / p>
不仅p标签也ul,ol等。
如何在Sublime Text 3上设置HTML的自动缩进格式?
一种选择是键入[命令] + [shift] + [p](或等价物),然后输入'indentation'。最重要的结果应该是'Indendtation:Reindent Lines'。按[enter]键,它将格式化文件。
另一个选项是安装Emmet插件( http://emmet.io/),这将提供不仅更好的格式,而且还有其他许多令人难以置信的功能。使用带Emmet插件的Sublime Text 3获得要查找的输出只需要以下内容:
p [tab] [enter] Hello world!
当您键入p [tab]时,Emmet会将其展开为:
< p>< / p>
按[enter]键进一步将其展开为:
< p>
< / p>
使用缩进的光标和标签之间的行。
表示键入文本的结果:
< p>
你好,世界!
< / p>
I have a question while I'm writing HTML code on Sublime Text 3. I just want to set auto indent format of HTML. For example, when I write p tag like under code, the indentation works like that.
<p>
Hello world!
</p>
But I want to write like under code instead of above.
<p>
Hello world!
</p>
And not only p tag also ul, ol and etc.
How can I set auto indent format of HTML on Sublime Text 3?
One option is to type [command] + [shift] + [p] (or the equivalent) and then type 'indentation'. The top result should be 'Indendtation: Reindent Lines'. Press [enter] and it will format the document.
Another option is to install the Emmet plugin (http://emmet.io/), which will provide not only better formatting, but also a myriad of other incredible features. To get the output you're looking for using Sublime Text 3 with the Emmet plugin requires just the following:
p [tab][enter] Hello world!
When you type p [tab] Emmet expands it to:
<p></p>
Pressing [enter] then further expands it to:
<p>
</p>
With the cursor indented and on the line between the tags.Meaning that typing text results in:
<p>
Hello, world!
</p>
这篇关于如何在Sublime Text 3上设置HTML自动缩进格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!