如何清理VI中的HTML文件缩进? [英] How do I tidy up an HTML file's indentation in VI?
问题描述
我如何修复他巨大的HTML文件的缩进,这些文件都搞砸了?
我尝试了通常的gg = G命令,这是我用来修复代码文件的缩进。但是,它似乎不适用于HTML文件。它只是删除所有的格式。
我也尝试设置:filetype = xml
,看看是否欺骗它使用 filetype认为这是一个XML文件将有所帮助,但它仍然没有做到这一点。 在
,Vim很好地缩进HTML文件。 .vimrc
中缩进
简单 shiftwidth
为2的示例:
< HTML>
< body>
< p>
text
< / p>
< / body>
< / html>
How do I fix the indentation of his huge html files which was all messed up?
I tried the usual "gg=G" command, which is what I use to fix the indentation of code files. However, it didn't seem to work right on HTML files. It simply removed all the formatting.
I also tried setting :filetype = xml
, to see if tricking it into thinking this was an XML file would help but it still didn't do it.
With filetype indent on
inside my .vimrc
, Vim indents HTML files quite nicely.
Simple example with a shiftwidth
of 2:
<html>
<body>
<p>
text
</p>
</body>
</html>
这篇关于如何清理VI中的HTML文件缩进?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!