In one of the most popular vimrc’s available (Aimx’s vimrc), there is a line which maps both leader and g:leader to “,”. https://github.com/amix/vimrc/blob/master/vimrcs/basic.vim#L58

  1. What is the difference between let mapleader and let g:mapleader?
  2. Why do you need both to be defined to “,”?

1 Answer 1


In the .vimrc, there is no difference between them.

Without an explicit scope, vim chooses between g: and l: depending on the context. l: is implicit within functions, g: is implicit everywhere else.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.