Is there a shortcut to jump from , e.g <XX>
to </XX>
?
I already give it a try with '%' , but it doesn't work for this situation.
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.
Sign up to join this communityYou 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:
matchit
plugin (see :help matchit-install
for instructions).:filetype plugin on
). Henceforth, whenever you edit a file detected as xml
or html
or some other tag-based markup language, the combination of the matchit
plugin and the filetype plugin files will allow the %
motion to match open and close tags.
matchit
itself seems to come with mostvim
distributions, but you'll still have to enable it yourself.:help matchit-install
for more.