I am reading the vim manual. I am having an unexpected result using the % command.
Here is a quote from the manual:
When the cursor is not on a useful character, "%" will search forward to find
one. Thus if the cursor is at the start of the line of the previous example,
"%" will search forward and find the first "(". Then it moves to its match:if (a == (b * c) / d) ---+----------------> %
However, when I repeat the same thing (placing the cursor at the start of the line) and press %, the cursor moves the last ) parenthesis instead.
I didn’t configure vim, I am using the default settings. I am wondering if my vim is not configured well. Is there a way to configure vim for it to move the cursor the first parenthesis similar to how it is described in the manual?
I am using gVim on Windows.
>Solution :
"it moves to its match", which means that it will move to the matching paranthesis of the one it found (in this case the closing paranthesis). So it does what it should.
To get back to the first paranthesis you will need to press ‘%’ again!