Delete a pair of XML/HTML tags
From Vim Tips Wiki
created 2006 · complexity basic · author bryan · version n/a
I've been editing a lot of XML lately and using the new tag text-objects (see :help tag-blocks). The it and at text-objects make it easy to delete/change/yank/etc the content between two matching tags either tag inclusive or not. In my editing I commonly have to remove just a matching pair of tags. Previously I had a nasty function for this which is now replaced with just mapping the following to the key of my choice:
I wanted to just yank the at text-object instead of visually selecting it, but it seems that the
`] marks are cleared when the first edit is made thus making it imposible to just back to the end of the object and kill the closing tag. For large blocks of text using the visual select causes a momentary flicker, but for smaller chunks of content it is not visible.
You could also use 'a>' blocks for that:
I don't know if use of visual selection could be avoided.