Vim default leader key on a MacBook
12,201
Solution 1
I use this command:
let mapleader = ','
Solution 2
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 ,
Author by
Cydonia7
Updated on June 04, 2022Comments
-
Cydonia7 almost 2 years
I use Vim on a MacBook Pro and in order to input
\
, I have to type inMaj + 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
,
? -
Julien Grenier about 11 yearsThe problem with that solution is that you lose the default usage of "," which is to reverse a character search. Example fa goes to the next "a" on the line then hit "," it goes to the previous "a". It is really useful if you use ";" to repeat a character search and you need to go back.
-
Justin D. over 10 years@JulienGrenier, Well,
,<space>
will still search for the reverse character. Personally, I don't reverse search a lot (I rarely get trigger-happy) and there is also F{char}) so having to type the extra space doesn't bother me...