2

In the following text block, starting at 1 or 3, and pressing % in normal mode in vim, finds the pair of matching parentheses, and toggles between them if you press % again. Starting at 1 finds the closing ) first. Starting at 3 finds the opening ( first. This is all OK and useful.

Some lines 1 with (stuff 2 in
matching 3 parentheses)

However, starting at 2 and pressing % finds nothing. What's going on?

Update: other commands such as vib can find the (...) block from either 2 or 3 (but not 1) which is one way around the limitation, but still curious...

1 Answer 1

3

This is actually the documented and expected behavior, from :help %.

Find the next item in this line after or under the cursor and jump to its match.

I do not know of any way to make % search beyond the current line. You could try ]) and its relatives as a workaround.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .