vim / vi / linux: properly indent html file
If your vim knows it's an html file (:se filetype=html
), you can use the default indentation method (gg=G
). I would have a look at :help =
, it's quite powerful
You can use the html tidy program to have your html file(s) indented. It could also potentially correct things and change more than just indentation, so it might do more than you ask for, but unless that is a problem you will end up with better html files as a result of running tidy.