Motion to target the matching brace/paren in Vim?
macvim, vim
Solution
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.
Problem
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.