7
3
For example, if I want to jump to the close form
tag. how could I do this?
7
3
For example, if I want to jump to the close form
tag. how could I do this?
6
The matchit.vim plugin, in conjunction with the html.vim filetype plugin, will allow you to do this. One way to load the matchit.vim plugin is to put this in your ~/.vimrc:
runtime macros/matchit.vim
If you don't already have filetype plugins enabled, also put this in in your ~/.vimrc:
filetype plugin on
Then when you edit an HTML file, you can jump from a tag to the matching tag by typing %
. You can find out more by executing
:help matchit
Thanks, this is perfect! Thought I had to install plugin but looks like it's included already. – Jason – 2013-04-22T21:34:58.537
4
You can jump between tags using visual operators, in example:
Your cursor should jump forward to the matching closing html/xml tag. To jump backwards from closing tag, press o or O to jump to opposite tag.
Now you can either exit visual by pressing Esc, change it by c or copy by y.
To record that action into register, press qq to start recording, perform tag jump as above (including Esc), press q to finish. Then to invoke jump, press @q.
See more help at :help visual-operators
or :help v_it
:
at a
<tag> </tag>
block (with tags)it inner
<tag> </tag>
block
Alternatively use plugin such as matchit.vim (See: Using % in languages without curly braces).
See also:
Related: How to jump between matching HTML/XML tags? at Vim SE
– kenorb – 2015-02-14T00:29:21.003