When using vim some django templates, for example:
<li> {% if sth %} <p>something</p> {% endif %} </li>
The indentation I require is as above, but in vim it will be forced to automatically indent the line "<p>" forward and become:
<li> {% if sth %} <p>something</p> {% endif %} </lil>
You must finish typing the line "<p>" and manually change the indentation. .
What I understand is that because this is an html file, vim treats it as a normal html indentation format and ignores the if tag in django.
So what should we do to make vim treat "{% %}" as a tag in HTML?
Can I think that {% if * %} and <li> in your code are of the same level? Or the following way of writing is more in line with the requirements and will not destroy the indentation structure of HTML.
The automatic indentation in VS2010 is the first type. I think VIM’s processing is correct.
Because compared to ul, indenting li by one tab is a good indentation.