3

I need to define LocalLeader for various plugins and I would like to set it to <Space>. If I add this to my vimrc file

let maplocalleader = "<Space>"

typing space in normal mode just moves the cursor by one position (i.e. my command had no effect). Setting the LocalLeader to

let maplocalleader = "\\"

allows mappings to work properly when prefixed by \. What am I doing wrong?

7

You should use this:

let maplocalleader="\<space>"

Note that the mapping is the same for the reguler leader let mapleader="\<Space>"

  • Thanks! I never thought I would need to escape that, it kind of defeats the point of having the <space> specifier. – Paul Irofti Dec 4 '17 at 12:05
  • 1
    @PaulIrofti See :h expr-quote actually mapleader and maplocalleader are VIM string variables thus it is not that surprising to escape the special keys. Also you should be able to use let maplocalleader = " " – statox Dec 4 '17 at 12:29
  • 1
    The first thing I did was to try maplocalleader = " ", but it did not work in my case. Thanks for the help reference! – Paul Irofti Dec 4 '17 at 13:39
1

You can use:

let mapleader = " "
let maplocalleader = " "

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.