Let's say I have a tag (and cursor at *):
<h1 class="blah" id="moo">H*ello!</h1>
I want to change it to:
*<h2 class="blah" id="moo">Hello</h2>
i.e. Change the type of tag, but keep all the elements.
Using surround.vim, I could do:
cst<h2>
but that changes the HTML to:
*<h2>Hello</h2>
Is just changing the tag possible, but keeping all the attributes? Surround documentation doesn't seem to contain anything like this...
I have xml.vim plugin (https://github.com/othree/xml.vim) . If you had it too, your requirement is rather easy.
Just move cursor to tag, press <leader>c
(lowercase c), then input new tagname, only tag name will be changed.
If you press <leader>C
(Big C), also rename the tag/element, but also original attributes are removed.