On Friday, September 27, 2013 7:27:27 PM UTC+2, glts wrote:
> On Friday, September 27, 2013 3:01:52 PM UTC+2, Codie Codemonkey wrote:
> > Object selections have become one of my favorite Vim features. (See :help object-select for some context for this request.) It took me awhile to discover them, but now that I have I use them constantly.
> >
> > I'd like to see a new one (or actually two considering the a and i forms) to select comma separated items in a list.
> >
> > In the simplest use case, comma object selection would include text starting at the previous comma or '(' to the next comma or ')'.
> >
> > a, - Select the current parameter in a C-style parameter list. Any previous whitespace will be included, as well as any trailing ','. Whitespace after the trailing ',' will not be included. If the parameter is the last in the parameter list, the ending delimiter will not be selected.
> >
> > i, - Same as a, except that leading whitespace and a trailing ',' (if present) will not be part of the selection.
> >
> > Other bracketing delimeters should work in addition to '(' and ')', including '[' and ']', '{' and '}' and possibly '<' and '>'.
> >
> > Examples:
> >
> > Consider this line of programming code:
> > func( a, b(c, d[0]), "this, is a test")
> >
> > In normal mode with the cursor on the first parameter, "da," would change this to:
> > func( b(c, d[0]), "this, is a test")
> >
> > Or, if the cursor is on 'b' in the second parameter, "da," would yield:
> > func( a, "this, is a test")
> > (Note the ignored ')' and ']' characters.)
> >
> > Or if the cursor was in the string of the third parameter, "da," would yield:
> > func( a, b(c, d[0]), )
> > (Note that the ',' in the string was not a delimiter because it was nested between quotes.)
> >
> > Some filetypes have other needs. For example in a CDF file, <C-R> is a bracketing character. To accommodate this I suggest some accompanying options:
> >
> > listsep - Characters used to separate items in a list. Default: ',;'
> > liststart - Characters used to start a list (if not nested in quotes or balanced bracketed strings). Default: '({[<'.
> > listend - Characters used to end a list (if not nested in quotes or balanced bracketed strings). Default: ')}]>'.
>
> this is a common and very reasonable request.
>
> And since it is so common, talented people have already thought of a
> solution many years ago :) ... The most popular framework for creating
> custom text objects is
>
> http://www.vim.org/scripts/script.php?script_id=2100
> https://github.com/kana/vim-textobj-user
>
> and what's even better, is that there is already a wealth of text
> objects made with that framework. See (especially textobj-parameter!):
>
> https://github.com/kana/vim-textobj-user/wiki
Also see
http://www.vim.org/scripts/script.php?script_id=2699
http://www.vim.org/scripts/script.php?script_id=4171
https://github.com/b4winckler/vim-angry
(And please do search vim.org/scripts, everything's there.)
--
--
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.
For more options, visit https://groups.google.com/groups/opt_out.
Friday, September 27, 2013
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment