Sunday, April 8, 2012

Re: catching the register command

On 08:23 Sun 08 Apr , sinbad wrote:
> suppose if i had mapped "p" to do some operation
> based on some variable, if that variable is not set
> the "p" should perform it's normal operation. now
> how can i catch the register contents or count
> before "p", for ex user might have pressed "ap,
> how do i catch "a in this case.
>
> fun! NewP()
> if var == 1
> "do something
> else
> "normal p
> endfun
>
> --
> 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

There is v:register variable (see :help v:register), for count there are even
two: v:count and v:count1 (also documented).

Best,
Marcin

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

No comments: