ci, (or something?)

33 views
Skip to first unread message

Jason Felice

unread,
Mar 10, 2018, 7:02:15 PM3/10/18
to vim...@vim.org
Is there something that changes a function parameter in a C-style language, e.g. delimited by commas or parens?  I find myself wanting this frequently.

Thanks,
-Jason

John Passaro

unread,
Mar 10, 2018, 9:08:52 PM3/10/18
to vim...@googlegroups.com, vim...@vim.org

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Gary Johnson

unread,
Mar 12, 2018, 5:53:38 AM3/12/18
to vim...@vim.org
On 2018-03-10, Jason Felice wrote:
> Is there something that changes a function parameter in a C-style language,
> e.g. delimited by commas or parens?  I find myself wanting this frequently.

ci) or ci( or cib will change everything within ( and ).
ct, will change everything from the cursor to the next comma.
T, will move the cursor to the right of the next comma to the left.

See

:help 04.2
:help 04.8
:help text-objects
:help left-right-motions

HTH,
Gary

Jason Franklin

unread,
Mar 12, 2018, 8:27:44 AM3/12/18
to vim_use
Hey Jason,

I use the plugin "targets.vim" (https://github.com/wellle/targets.vim) for this exact purpose. When you install this plugin, you will have the option to "cia" or "caa" or "dia", etc. It also includes a number of other useful text objects you may have never considered (i.e., to change between two "/" chars in a path, use "ci/").

The project is also maintained. I submitted an issue not too long ago, and it was eventually fixed.

Best,
Jason Franklin

Jason Felice

unread,
Mar 12, 2018, 10:19:03 AM3/12/18
to vim...@googlegroups.com
@John @Jason . Thanks!  Both seem neat!  I'm going to try vim-angry for now, since target changes a bunch, including things I probably rely on.

Thanks,
-Jason

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.

Ben Fritz

unread,
Mar 13, 2018, 12:22:43 AM3/13/18
to vim_use
Here's a pull request I've been using that adds a "matched character" text object. My most common use is probably commas just as you say.

https://github.com/vim/vim/pull/958
Reply all
Reply to author
Forward
0 new messages