4

I've tried

let mapleader = '<space>'
let mapleader = ' '
let mapleader = ','

None of them works. VIM doesn't even show coma in the status bar (bottom of the screen?), but it works perfectly in insert mode. Spacebar just goes ahead one character.

Why could this be happening?

  • In which file are you writing this setting? Just to make sure, try let mapleader="," with double quotes instead of single. – ap0 Dec 10 '14 at 18:34
  • mapleader is something you cannot change dynamically, i.e. if you change mapleader it doesn't go back and change all the mappings already defined. So, repeating the question, what file are you setting this in? Is it before or after your mappings? You are setting it in a file, correct? – Ben Dec 12 '14 at 11:15
  • 1
    OK, guys, sorry for not answering, got caught up in something for a couple days. I'm embarrassed to say I was NOT setting this in a file. Does that have something to do? I was just pressing ":" and then the setting. It was my understanding that should work as well as putting into ~/.vimrc for the session, at least. – joaquinlpereyra Dec 13 '14 at 2:01
  • Nope, setting mapleader to a value only affects mappings that get defined after you set mapleader. So if you were to manually create a mapping after this, that mapping would work as you expect, but none of your earlier mappings (e.g. from your .vimrc) are re-interpreted. – Ben Dec 13 '14 at 13:34
6

You need to set mapleader in your ~/.vimrc, before any mappings are defined or plugins loaded. From :help mapleader:

Note that the value of "mapleader" is used at the moment the mapping is defined. Changing "mapleader" after that has no effect for already defined mappings.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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