-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make separator objects respect parentheses #56
Comments
I definitely agree that it would be useful to have a text object for function arguments. Right now this is not supported. Separator text objects use a very simple mechanic and all actions seen in your screencast are working as expected. It might be possible to use a more complex logic to account for the use case you mentioned, but that could have implications regarding seeking. Also just ignoring any parentheses might not be enough. In this example I would have to handle matching pairs and skip over separators: foo(a, 4 + bar(c[0], x), d) I would like to make handling of arguments possible with targets.vim, but at the moment I don't have a clear idea about what would be reasonable. If you have any more input on this, please let me know! I also commented on this topic in #14 (comment):
|
Fair enough, thanks for your response. |
Just wanting to let you know that I started working on this. It would be a new text objects
I disagree on foo(a, b + "bar", c)
foo(a, b + 'x', c)
foo(a, std::bar, c) Do you agree on the separators I listed and the behavior I described? |
Fantastic news, I hope it goes well! Re: quotes, I mostly agree on your cases. std::bar is a corner case because The case where there's a parenthetical end-of-line comment is hard to How will you handle Watching my screencast again, I'm not sure why from On 6 May 2014 00:25, Christian Wellenbrock notifications@github.com wrote:
Cheers, |
+1 for function arguments operator. That would be really cool. |
For function arguments there is already PeterRincker/vim-argumentative. Incorporating this functionality in targets.vim might be difficult. I suggest staying true to the 'Do one thing and do it well' philosophy. |
I agree - let's close this? On 29 May 2014 17:13, UnrealQuester notifications@github.com wrote:
Cheers, |
@UnrealQuester @lxsli In general I agree. But I think that next and last argument text objects are really useful. I am making good progress in implementing them. |
https://asciinema.org/a/9101 - in which I thrash around trying to use these text objects without very much success
As far as I can pin down, separator objects don't respect their context very well. IE a comma-separated list extends through parentheses. I'd love to be able to "da," to delete a function parameter, but this doesn't work for the first or last right now.
If parentheses-respect were an option, that'd be OK, although it'd be nice if you could pick sane behaviour based on filetype.
Besides (), I'd also expect a comma list to end at [], {}, "", '', colon, semicolon and almost certainly others.
The text was updated successfully, but these errors were encountered: