On Jul 17, 2:05 am, Tony Mechelynck <[email protected]>
wrote:
> On 16/07/09 20:27, Ben Fritz wrote:
> > On Jul 16, 12:23 pm, Edward Beach<[email protected]> wrote:
> >> Is there a way to define mappings local to a diff window?
>
> >> I have some specific mappings that I would like enabled when I'm in
> >> diff mode. Normally I would set this using map<buffer> but on some
> >> occasions I have the buffer in one window and a diff of the buffer in
> >> another. In the original buffer,&diff == 0 and in the diffed buffer
> >> &diff == 1 so is there an easy way to enable a mapping specific to the
> >> window containing the diffed buffer?
>
> >> Thanks!
>
> > Almost there! Check out :help :map-<expr> for the final piece.
>
> > The help may not make this clear, but it seems from experimentation
> > that<buffer> and<expr> can be used together without trouble.
>
> Yes. The reply quoted above may not make this clear, but mappings can be
> buffer-local but not window-local; so the {rhs} itself has to test
> whether we're in a diff window or not, and act differently according to
> the result (maybe returning the {lhs} if we aren't).
>
> But since I don't see an autocommand event to detect that a given window
> has become a diff window, maybe the mapping should be global?
>
> map <expr> <F4> (&diff?"osome stuff\e":"\<F4>")
>
> Best regards,
> Tony.
> --
Thanks!
When I use the <buffer> <expr> (or <expr> <buffer>) combination my
mapping is pre-pended with an @ sign when I list the mapping:
i.e @(&diff ? ... )
and consequently I can't unmap the mapping -- what does the @ mean?
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---