Thursday, April 28, 2011

Re: Where is defined?

> If you later change one or both of hese variables, already defined
> mappings are unaffected; the value used is always the value at the
> time the mapping is *defined*.

The upshot of which is that you should be able to do something like:

:let s:saved_maplocalleader = g:maplocalleader
:if exists('g:vimoutlinerleader')
:let g:maplocalleader = g:vimoutlinerleader
:else
:let g:maplocalleader = ",,"
:endif
:map <LocalLeader>foo bar
:noremap <LocalLeader>blah blahblahblah
...
:let g:maplocalleader = s:saved_maplocalleader
:unlet s:saved_maplocalleader

As long as you aren't dynamically defining mappings (e.g. using one
mapping to define another, or using an autocommand to define mappings,
etc.), this should work easily.

Ben.

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