Vim only solution
The simplest thing for the example you posted is probably to use visual
linewise mode -
va)Vwill first select the content and the surrounding
parenthesis (but not the word in front) and the final
V will switch to
linewise mode (thus additionally selecting everything before/after the
The above would not work in the more general case where you want to select the
inner function call (but not the outer one):
), some, more, args, here)
This case would need vim to have an understanding of what constitutes a
Vim plugin solution (text objects)
I wrote the vim-surround-funk
plugin to do this kind of thing (and related things - see the end). In your case, the plugin gives you a new text
i/a function call'), so you could use either
visually select and then yank it, or just
yif to yank it directly:
Here are some visual selections of the text objects. Capitalising (i.e.
aF) extends the
characters considered as legal function name characters (e.g. the
python, but you can configure this). There is also the
objects (and their capital versions) that select the function call name. N.B.
In the below, the cursor can be in a variety of positions (but the cursor moves
after the selection, and I can't post the gif from the repo...):
But wait there's more!
The plugin was inspired by tpope's vim-surround plugin and allows you to delete, change and yank a surrounding function call along with its additional arguments. With the surrounding function call in the unnamed register, you can 'grip' any text object with it (including a different function call). 'Gripping' will wrap/encompass a word or function call with the one you have in the unnamed register.