vim-textobj-python icon indicating copy to clipboard operation
vim-textobj-python copied to clipboard

Add object for an entire function call

Open languitar opened this issue 9 years ago • 5 comments

In case I have a function call defined across multiple lines, is there any mapping to select the entire call? Otherwise, I would like to have such a text object.

languitar avatar Nov 26 '15 15:11 languitar

Can you provide an example? If it's something like

foo(bar,
    baz,
    quux)

how about doing e.g. va)ob within the parens to get a visual selection?

bps avatar Nov 30 '15 21:11 bps

Yes, that's the case. That is just a horribly long shortcut and to my mind it would make sense to have something language-specific inside here. Also for people to actually find the right shortcut ;)

languitar avatar Dec 01 '15 08:12 languitar

Oh, and additionally, this doesn't work if there is an embedded function call. I might end up selecting only that one.

languitar avatar Dec 01 '15 08:12 languitar

Yeah, you're screwed if you have embedded function calls. This is also the reason why it's not possible to do it right with regular expressions. :smile:

I'm not sure I've needed this. I'm open to taking a patch, but I think the current kludgy approach the rest of the plugin uses isn't going to apply.

Have you looked at https://github.com/terryma/vim-expand-region for doing something similar? It's a more general approach?

bps avatar Dec 01 '15 18:12 bps

I didn't look at expand-region so far.

I am using this to send portions of code to ipython using vim-slime. And since I often have to reuse certain lines of code for experimentation, such a feature would be very handy.

languitar avatar Dec 01 '15 20:12 languitar