How can one close HTML tags in Vim quickly?
I find using the xmledit plugin pretty useful. it adds two pieces of functionality:
- When you open a tag (e.g. type
<p>
), it expands the tag as soon as you type the closing>
into<p></p>
and places the cursor inside the tag in insert mode. If you then immediately type another
>
(e.g. you type<p>>
), it expands that into<p>
</p>
and places the cursor inside the tag, indented once, in insert mode.
The xml vim plugin adds code folding and nested tag matching to these features.
Of course, you don't have to worry about closing tags at all if you write your HTML content in Markdown and use %!
to filter your Vim buffer through the Markdown processor of your choice :)
I like minimal things,
imap ,/ </<C-X><C-O>