vim tip - equalprg to your favorite tidy-er
I've often wanted to reformat only a section of code or html in vim . Thanks to a pointer by another site (which I can't find at this time). I ran across the equalprg . Most of the time this will reformat a selected block in the current cindent level. This probably will work ok for html except if you want it to make sure all the tags are closed. But since this can be set to anything, you can change it over to use a tidy program (like perltidy or tidy). For Perl add: set equalprg=perltidy\ -nola For html tidy, you need to tell tidy to use XML only: set equalprg=tidy\ -i\ -xml