Last Updated: February 25, 2016
· supersymmetry

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.


Which will split all <tags> to their own lines. In order to remove the empty spaces use:


After which you can use


Thanks to Chris Morgan

Say Thanks

3 Responses
Add your response


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

over 1 year ago ·

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

over 1 year ago ·
Avatar 73 normal

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 ;)

over 1 year ago ·