Search code examples
vimparenthesesmotioncursor-position

Movement to the closing parenthesis from inside block


I want a movement to get from point 1 to points 2 and 3:

FunctionCall(a, b, c, AnotherFunc(a, b))
            ^ <---  ^   ------------>  ^
            3       1                  2

Ideally it would work with editing operations like d, y etc

Now I count closing parentheses visually and use <n>f), but it's very annoying.

Vim does have facilities to know about blocks, i.e. i(, a(, but I want 'a half' of such a command.

How can I achieve this?


Solution

  • What I usually do is using a suitable commands from various-motions.

    For example, for your particular case ]) followed by % will help.

    They can be combined with operations like d, y and c.

    More details using :help various-motions