I usually format xml or html by doing:
- =G
However, this doesn't work if the file is minified to one line only, which I very commonly have with xml. Is there a way to format one-lined html or html in vim easily (i.e., without a plugin)?
Additionally, the block formatting is pretty crude in vim ('formatting' might be an ambitious word, as it seems more to be an 'indenter'), for example the following:
<footer>
<div class="container"><div class="row"><div class="col-md-12">
<small id="copyright">© 2016 MySite
</small>
</div></div></div>
</footer>
Gets formatted as the following in vim:
<footer>
<div class="container"><div class="row"><div class="col-md-12">
<small id="copyright">© 2016 MySite
</small>
</div></div></div>
</footer>
Whereas here is what it does in TextMate:
<footer>
<div class="container">
<div class="row">
<div class="col-md-12">
<small id="copyright">© 2016 MySite</small>
</div>
</div>
</div>
</footer>