emmet-vim icon indicating copy to clipboard operation
emmet-vim copied to clipboard

Feature request: Change tag

Open robertjk opened this issue 5 years ago • 4 comments

A feature I find missing in this plugin is changing tag type.

Let's say I have a <div>:

<div class="header>
  ...
</div>

At some point I decide to change <div> to <head>:

<head class="header">
  ...
</head>

I do this operations a lot whenever I'm writing HTML. So far I don't know of any quick way to do it other than editing both closing and opening tags separately and that can get quite hard, when the opening and closing tag are far away. Would be great if Emmet supported this.

Note: I created a feature request for that in the main Emmet repo, but was told that this is currently not suited for the main Emmet tool, but should rather be implemented as a plugin feature.

robertjk avatar Sep 09 '19 20:09 robertjk

tpope's vim-surround plugin offers a mapping (cst -- "c"hange "s"urrounding "t"ag) to facilitate this operation

chunga2020 avatar Feb 20 '20 19:02 chunga2020

tpope's vim-surround plugin offers a mapping (cst -- "c"hange "s"urrounding "t"ag) to facilitate this operation

That works differently, because it changes both the tag and any content inside the tag: cit only contents between the tags, cat both contents between the tags and the tags themselves.

The alternative I found is vim-matchup plugin, in which you just change a name of closing or starting tag and it automatically updates the other one. Works super good for me.

robertjk avatar Feb 20 '20 20:02 robertjk

vim-matchup is not changing the tag for me, for information, take a look at https://github.com/AndrewRadev/tagalong.vim

augustobmoura avatar May 07 '21 15:05 augustobmoura

doesn't emmet-update-tag (ctrl y + u) do the job?

Calbabreaker avatar Feb 07 '22 13:02 Calbabreaker