The wellle/targets.vim
plugin should do what you're looking for (and much more). This allows you to explicitly tell vim to go to the next parenthesis (with cin(
, n for next parenthesis), or the last parenthesis (with cil(
), but it also overrides the default so that you jump to the next or last if you don't specify. From the README:
- This overrides Vim's default text object to allow seeking for the next pair in the current line to the right or left when the cursor is not inside a pair. This behavior is similar to Vim's seeking behavior of
di'
when not inside of quotes, but it works both ways.
...
Next and Last Pair
in( an( In( An( il( al( Il( Al( ...
Work directly on distant pairs without moving there separately.
All the above pair text objects can be shifted to the next pair by including the letter n. The command in) selects inside of the next pair. Use the letter l instead to work on the previous (last) pair. Uses a count to skip multiple pairs. Skipping works over multiple lines.
See our Cheat Sheet for two charts summarizing all pair mappings.
This also adds the "argument" text object. For example, dana
to delete the next argument. And many other text objects as well.
ci(
andci"
behave differently.