sponsor Vim development Vim logo Vim Book Ad

tagalong : Change an HTML(ish) opening tag and take the closing one along as well

 script karma  Rating 8/5, Downloaded by 854  Comments, bugs, improvements  Vim wiki

created by
Andrew Radev
script type
Github repository: https://github.com/AndrewRadev/tagalong.vim

The plugin is designed to automatically rename closing HTML/XML tags when editing opening ones (or the other way around). For the most part, you should be able to edit your code normally (see documentation for limitations) and the plugin would take care of the renaming once you leave insert mode. You can see a demo gif here: http://i.andrewradev.com/f52337c3b41b6f2269407c1b332caf9c.gif

Apart from HTML tags, it'll also detect XML-style `<namespaced:tags>`, react-style `<Component.Subcomponents>`, ember-style `<component/paths>`.

The plugin only activates for HTML-like buffers, or at least all the ones that I could think of. You can see the full list in the setting `g:tagalong_filetypes`. You can set that variable yourself to limit it to the ones you use. You can activate the plugin for more filetypes by changing `g:tagalong_additional_filetypes` (but consider opening an issue to suggest changes to the default list). See the documentation for more details.
install details
The easiest way to install the plugin is with a plugin manager:

- vim-plug: https://github.com/junegunn/vim-plug
- Vundle:   https://github.com/VundleVim/Vundle.vim

If you use one, just follow the instructions in its documentation.

You can install the plugin yourself using Vim's "packages" functionality by cloning the project (or adding it as a submodule) under `~/.vim/pack/<any-name>/start/`. For example:

    git clone https://github.com/AndrewRadev/tagalong.vim ~/.vim/pack/_/start/tagalong

This should automatically load the plugin for you on Vim start. Alternatively,
you can add it to `~/.vim/pack/<any-name>/opt/` instead and load it in your
.vimrc manually with:

    :packadd tagalong

If you'd rather not use git, you can download the files from the "releases" tab and unzip them in the relevant directory: https://github.com/AndrewRadev/tagalong.vim/releases.

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
tagalong.zip 0.2.0 2019-06-21 7.4 Andrew Radev - Timeout implemented for large files with lots of tag nesting.
- Fix bug with nested `<SelfClosing/>` tags, disable support for `/` in the body of a tag (hopefully not actually used for anything)
- Allow deinitialization of the plugin in a buffer
tagalong.zip 0.1.3 2019-06-07 7.0 Andrew Radev - Support multi-line opening tags
- Fix issue with editing a closing tag
tagalong.zip 0.1.2 2019-05-04 7.4 Andrew Radev Bugfixes
tagalong.zip 0.1.1 2019-04-30 7.4 Andrew Radev Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.