Front-end web development tricks in Vim: Uncompress HTML
Vim is a very powerful and versatile editor, I like to use it as my IDE for any code work, for example some front-end web development in HTML5/CSS3 and optionally JavaScript frameworks.
In the rare occasion I find compressed HTML, this is a way to reformat it quickly in vim using regular expressions.
:s/<[^>]*>/\r&\r/g
Which will split all <tags> to their own lines. In order to remove the empty spaces use:
:g/^$/d
After which you can use
=
Thanks to Chris Morgan
Written by Rob Jens
Related protips
3 Responses

If you have Tidy installed on your machine, it gets even easier. http://coderwall.com/p/lb-obq

Probably yes :) I have Steve Francia's SPF13 setup...and with all those plugins in vundle, there must be countless more ways you could do this

Thanks for this. I'm sure there might be some more elegant way to make this happen but you still managed to save me 15 minutes of my life ;)