So, Vim, like most programming-minded text editors, highlights a matching "scope" character (such as (
and )
, <
and >
, and {
and }
).
I'm wondering, is there a motion to reach that character from the other? Like, with the caret on a <
, to move to the (highlighted) matching >
?
I know [action]t>
or [action]f>
would accomplish something similar. That's not what I'm asking.
The motion is: %
.
Used alone, this jumps between open/close pairs based on the value of the matchpairs
option.
But angle brackets - <>
- aren't included by default. They may be set based on the filetype
. The HTML filetype plugin sets it, so if you're opening HTML files you'll be able to use %
to jump between matching angle brackets. But not for e.g. C++/Java.
To add angle brackets if they aren't jumped when using %
, use:
:set matchpairs+=<:>
Now using %
on angle brackets should jump to the matching bracket.
See :help 'matchpairs'
and :help various-motions
- %
is the first mentioned - for more details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With