David Fishburn wrote:

> On Oct 30, 1:38 pm, Bram Moolenaar <[EMAIL PROTECTED]> wrote:
> > Ben Schmidt wrote:
> > > > 3.  Don't know about v:operator (works for me), the showcmd option
> > > > means it could also be v:command or v:operatorcommand (since there is
> ...
> > I'm not quite convinced adding v:operator is useful.  What would help is
> > giving a couple of examples how it's used.  Also, in the docs for
> > v:operator it would be good to have a few examples of the values.  I
> > suppose it can be one char, like "d", but also something longer.  How
> > about the count, e.g., when I do "4d"?
> 
> Here is a simple example:
> 
> function! MyOp(op)
>    let cmd = a:op
>    echo 'v:count:' v:count 'v:register:' v:register 'v:operator'
> v:operator 'you pressed:' cmd
>    exec "normal! ".
>                \ ((v:count > 0)?(v:count):'').
>                \ (v:register=='"'?'':'"'.v:register).
>                \ v:operator.
>                \ cmd
> endfunction
> 
> omap w :call MyOp('w')<CR>
> omap e :call MyOp('e')<CR>
> omap $ :call MyOp('$')<CR>
> 
> If you type the following commands:
> c$
> 2yw
> "a3de
> 
> You will get the following output:
> v:count: 0 v:register: " v:operator c you pressed: $
> v:count: 2 v:register: " v:operator y you pressed: w
> v:count: 3 v:register: a v:operator d you pressed: e
> 
> What this provides is all the information to capture what the user
> pressed which Vim does not currently support.
> 
> In the YankRing case, I will be able to replay what the user typed and
> still manage to capture the registers.
> 
> This is very useful for me, but I suspect other plugin developers will
> also benefit since they can make smarter functions by looking at what
> the user has keyed in.

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.

-- 
hundred-and-one symptoms of being an internet addict:
64. The remote to the T.V. is missing...and you don't even care.

 /// 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
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui