Ben Schmidt wrote:
> > Well, I can see that you get the information, but this is not really a > > useful real-world example. Think of a user that wants to get something > > done for which v:operator is needed. And for which there is no other > > solution. > > Here's a somewhat naively implemented example where a custom > text-object is defined that allows you to operate on a function name > whether the cursor is on the name itself or on its arguments. You can > yank with yF, change with cF, uppercase with gUF, etc. I can't think > of any other way to do this, or more complicated language-based custom > text-object definition--e.g. yank/change a whole conjunction or > disjunction in a logic language, yank or change the condition of an > 'if' or 'while' loop from anywhere within its body. Some of these > would be more useful than others, of course, but there are a lot of > real world possibilities, I think. > > Ben. > > > :onoremap F <Esc>:call OperateFunctionName()<CR> > function! OperateFunctionName() > let last_count = v:count > let last_op = v:operator > let last_reg = v:register > exe "normal \<Esc>" > while search('\(\%#\i\|\i\s*\%#\)\i*\s*(','ce',line('.')+1) == 0 > normal [( > endwhile > exe "normal \<BS>\"_yiw" > echo 'normal '.(last_count>0?(last_count):'').'"'.last_reg.last_op.'e' > endfun I see. In general the reason we need v:operator would then be that you need it for situations where you need to get out of operator pending mode, move around and restart the operator. Did you copy the v:variable values because they change when executing the other commands? A remark about that will be useful in the docs. OK, I'll include the patch after sufficient testing. -- hundred-and-one symptoms of being an internet addict: 70. ISDN lines are added to your house on a hourly basis /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ download, build and distribute -- http://www.A-A-P.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org /// --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_dev" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---