Auto formatting in VIM

formattinghtmlvim

I have a HTML like this:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Index - feedman</title>
   <link rel="stylesheet" href="/media/bluetrip/css/screen.css" type="text/css" 
media="screen, projection">
[...]
<body>
    <div class="container">
<div id="greeting">
{% if request.user.is_anonymous() %}
<a href="{{ create_login_url() }}">login</a>
{% else %}
Hello {{ request.user }}! <a href="{{ create_logout_url() }}">logout</a>
{% endif %}
</div>

<p>
{{ message }}
</p>
    </div>
</body>
</html>

How should I automatically format with proper indentation using VIM?

Best Answer

Perhaps you could try : gg=G to indent all the document ? I'm not sure it works good with HTML.

Related Question