October 2015
Intermediate to advanced
356 pages
7h 54m
English
| Tip 55 | Jump Between Matching Parentheses |
Vim provides a motion that lets us move between opening and closing pairs of parentheses. By enabling the matchit.vim plugin, we can extend this behavior to work on pairs of XML tags as well as on keywords in some programming languages.
The % command lets us jump between opening and closing sets of parentheses (see %ⓘ). It works with (), {}, and [], as this example demonstrates:
| Keystrokes | Buffer Contents | ||
|---|---|---|---|
{start} |
| ||
% |
| ||
h |
| ||
% |
| ||
l |
| ||
% |
|
To see how we might use % in practice, let’s use this short extract of Ruby: