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

前端 未结 16 2272
不知归路
不知归路 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条回答
  •  广开言路
    2020-12-02 03:59

    1G=G. That should indent all the lines in the file. 1G takes you the first line, = will start the auto-indent and the final G will take you the last line in the file.

提交回复
热议问题