Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim default leader key on a MacBook

Tags:

vim

macos

macvim

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 , ?

like image 888
Cydonia7 Avatar asked Jun 20 '12 15:06

Cydonia7


People also ask

What is the default vim leader Key?

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.

How do I use leader key in Vim?

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.

What is local leader in Vim?

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.


2 Answers

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 ,

like image 58
darryn.ten Avatar answered Sep 25 '22 16:09

darryn.ten


I use this command:

let mapleader = ','
like image 21
kev Avatar answered Sep 25 '22 16:09

kev