Change HTML tag in vim, but keeping the attributes (surround) -
let's have tag (and cursor @ *):
<h1 class="blah" id="moo">h*ello!</h1>
i want change to:
*<h2 class="blah" id="moo">hello</h2>
i.e. change type of tag, keep elements.
using surround.vim, do:
cst<h2>
but changes html to:
*<h2>hello</h2>
is changing tag possible, keeping attributes? surround documentation doesn't seem contain this...
i have xml.vim plugin (https://github.com/othree/xml.vim) . if had too, requirement rather easy.
just move cursor tag, press <leader>c
(lowercase c), input new tagname, tag name changed.
if press <leader>c
(big c), rename tag/element, original attributes removed.
Comments
Post a Comment