Show current <leader> key setting?
I'm having a problem with VIM whereby none of my commands work.
Is there a way I can see what my <leader>
is currently set to?
To see the current value currently defined for <leader>
, use:
:let mapleader
Producing output like:
mapleader ,
It may be undefined if not previously set, defaulting instead to a backslash \
By default mapleader
is not set, and special string "<Leader>"
means \
.
If you do:
:echo mapleader
you will get
Undefined variable: mapleader
Invalid expression: mapleader
If you want to set special string "<Leader>"
to a different key, say ","
, which is recommended by many, do:
:let mapleader=","
Then
:echo mapleader
,
Fortunately, map
expands <key_name>
values in both the LHS and RHS. You can exploit this to see the value of <Leader>
even if it is the default value.
:nmap temp :echo('your leader is "<Leader>"')<Esc>| execute 'normal temp'| nunmap temp
Note that if you put this in your .vim/vimrc
it will pause with "Press ENTER or type command to continue". Please comment if you know how to fix this.