I see <leader>
in many .vimrc files, and I am wondering what the meaning of it is? What is it used for? Just a general overview of the purpose and usage.
Thanks!
I see <leader>
in many .vimrc files, and I am wondering what the meaning of it is? What is it used for? Just a general overview of the purpose and usage.
Thanks!
The "Leader key" is a way of extending the power of VIM's shortcuts by using sequences of keys to perform a command. The default leader key is backslash. Therefore, if you have a map of <Leader>Q, you can perform that action by typing \Q.
In my system its the \
key. it's used for commands so that you can combine it with other chars.
See
:help leader
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.