Sunday, April 8, 2012

Re: catching the register command

On Apr 8, 2012, at 11:23 AM, sinbad <sinbad.sinbad@gmail.com> 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

If can create an expression map for p. this will call your own function.

The YankRing plugin uses this technique.

--
David Fishburn

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