> Hi all,
>
> Where is<localleader> defined? How would I define a similar variable called
> <voleader> so that it's available for use in various Vimscript programs?
>
> Thanks
>
> SteveT
>
> Steve Litt
> Recession Relief Package
> http://www.recession-relief.US
> Twitter: http://www.twitter.com/stevelitt
>
See the following, at :help <Leader> and :help <LocalLeader>:
> *<Leader>* *mapleader*
> To define a mapping which uses the "mapleader" variable, the special string
> "<Leader>" can be used. It is replaced with the string value of "mapleader".
> If "mapleader" is not set or empty, a backslash is used instead. Example: >
> :map <Leader>A oanother line<Esc>
> Works like: >
> :map \A oanother line<Esc>
> But after: >
> :let mapleader = ","
> It works like: >
> :map ,A oanother line<Esc>
>
> Note that the value of "mapleader" is used at the moment the mapping is
> defined. Changing "mapleader" after that has no effect for already defined
> mappings.
>
> *<LocalLeader>* *maplocalleader*
> <LocalLeader> is just like <Leader>, except that it uses "maplocalleader"
> instead of "mapleader". <LocalLeader> is to be used for mappings which are
> local to a buffer. Example: >
> :map <LocalLeader>q \DoItNow
> <
> In a global plugin <Leader> should be used and in a filetype plugin
> <LocalLeader>. "mapleader" and "maplocalleader" can be equal. Although, if
> you make them different, there is a smaller chance of mappings from global
> plugins to clash with mappings for filetype plugins. For example, you could
> keep "mapleader" at the default backslash, and set "maplocalleader" to an
> underscore.
IOW, if you
:let maplocalleader = '_'
then from now on, any _new_ mappings defined with <LocalLeader> will use
an underscore for it, instead of the default backslash.
Whenever a new macro is defined, if it is written with <Leader> in it,
Vim replaces that symbol with the value of the variable named mapleader
(or a backslash if empty or undefined), and if it uses <LocalLeader>,
Vim uses the value of maplocalleader (or a backslash if empty or undefined).
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*.
Best regards,
Tony.
--
"When in doubt, tell the truth."
-- Mark Twain
--
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:
Post a Comment