I use Vim on a MacBook Pro and in order to input \
, I have to type in Maj + Alt + /
. Vim's leader key is bound by default on \
but typing the whole "shortcut" doesn't seem to work as a leader key.
Is there a way to make it work or should I use another leader key like ,
?
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.
The default <leader> key is a backslash \ . To change the leader key to the comma , add let mapleader = “,” to your vimrc (to use the space key add let mapleader = “ “). Reload vim and test your new <leader> key. The leader key can be whatever key you choose.
Vim has a second "leader" key called "local leader". This is meant to be a prefix for mappings that only take effect for certain types of files, like Python files or HTML files.
Put the following line into your .vimrc in order to use , as your leader
let mapleader = ','
Save your .vimrc and reopen vim. Your leader is now ,
I use this command:
let mapleader = ','
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With