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 fil
This is my solution that works nicely for opening "ugly" HTML in a nicely spaced way:
vim fileIn.html -c "set sw=2 | %s/>/>\r/ | execute 'normal gg=G' | set nohlsearch | g/^\\s*\$/d"
sw
command is because my default is 4, which is too high for HTML.>
).=
.>
(since I have set hlsearch
in my vimrc).You can even add | wq! fileOut.html
to the end if you don't want to enter Vim at all, but just clean up the file.