Month: October 2013

HTML indent settings in Vim

Despite not agreeing with all of it, “Just Use Sublime Text” (an invective against Vim — or, more accurately, against recommending Vim to anyone who isn’t already indoctrinated by it) by Andrew Ray is an interesting read. The section dealing with indenting in particular struck a chord with me:

Paste this into an empty buffer:

<div>
<p>
<span>foo</span>
</p>
</div>

:set ft=html and then gg=G. Let me know what you get. In all seriousness, never, ever tell me what you get.

As I said in a tweet, what I got didn’t offend me too much. But many people would argue that the <span> tag should be indented inside the <p> tag. I’d probably do this myself, actually — and there have been aspects of Vim’s indenting that irk me. So I set about finding a solution.

Continue reading “HTML indent settings in Vim”

Leave a Comment