mattn / emmet-vim

emmet for vim: http://emmet.io/
http://mattn.github.io/emmet-vim
MIT License
6.41k stars 410 forks source link

Feature request: Change tag #469

Open robertjk opened 5 years ago

robertjk commented 5 years ago

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.

chunga2020 commented 4 years ago

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

robertjk commented 4 years ago

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.

augustobmoura commented 3 years ago

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

Calbabreaker commented 2 years ago

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