Learn Vim / Balanced demolition — vim

Balanced demolition — vim

The answerCanonical keystrokes: f( d%.

Try it on a real buffer

Delete the whole argument group, parentheses and all. Jump onto the first ( with f(, then delete to its match with d%.

result = compute(a, b, (c + d), e) + trailing

Canonical solution: f( d% · par: 4 keystrokes (vimgolf rules — every keypress counts).

Why it works

% jumps between matching (), [], {} — and as a motion, d% deletes the entire balanced pair and everything inside, even when they're nested. No counting brackets by eye.

Reading about keystrokes doesn't build keystrokes. Try this in a real vim buffer right now — the “Balanced demolition” mission takes about a minute.

Practice free — no signup →

Keep going