How to delete HTML tags, not the contents in Vim
With the surround.vim plugin installed, press d s t to delete surrounding tag.
Similar shortcuts:
-
d s ( - delete surrounding parentheses
()
-
d s " - delete surrounding double quotes
""
-
d s ' - delete surrounding single quotes
''
and so on...
A simple solution would be (with the cursor anywhere inside the tag):
yitvatp
What this does is:
-
y
- yanks -
it
- the inside of the tag -
vat
- selects the entire tag -
p
- pastes the previously yanked text over it