Match Bracket

% โ€” jump to the matching paren, brace, or bracket.

Keys: %

% jumps from one bracket to its mate. The cursor needs to be on a bracket (or before one on the line). It's also a motion, so d% deletes a paired block.

Cursor on (? Press %. You're on the matching ). Press it again โ€” back. % works for (), [], {}, and (with plugins) tag pairs and language constructs.

Jump to matching bracket
KeyNote
%
Delete from here through the matching bracket
KeyNote
d
%
Visual-select to the matching bracket
KeyNote
v
%
% โ€” match bracket

Reference

Key Action
% Jump to matching bracket
d% Delete from here to match (inclusive)
y% Yank to match
c% Change to match

Worked example โ€” % on different brackets

% picks the right pair automatically.

Step 1 ยท Cursor on '['.
Cursor on '['.
Step 2 ยท % ยท % โ€” to ']'.
% โ€” to ']'.
Step 3 ยท ww % ยท From '(', % goes to ')'.
From '(', % goes to ')'.

โ–ถ Try this in the simulator

See also: Bracket Text Objects, Percentage and Column Jumps