How do I fix the indentation of an entire file in Vi?

前端 未结 16 2245
不知归路
不知归路 2020-12-02 03:24

In Vim, what is the command to correct the indentation of all the lines?

Often times I\'ll copy and paste code into a remote terminal and have the whole thing messed

16条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-02 03:43

    You can use tidy application/utility to indent HTML & XML files and it works pretty well in indenting those files.

    Prettify an XML file

    :!tidy -mi -xml %
    

    Prettify an HTML file

    :!tidy -mi -html %
    

提交回复
热议问题