I've tried setting localleader using:

:let localleader="]"

And it seems to be 'working':

:let localleader
localleader            ]

However, when I try and run a command using localleader, it doesn't seem to register, and is using the general leader. For example, after I do:

:autocmd FileType python nnoremap <localleader>c I#<esc>

Hitting ]c does nothing...but hitting \c (normal leader) actually works. What's wrong here? Perhpaps I'm misunderstanding the use of leader vs mapleader ?

  • 2
    Leader keys need to be set before any mapping that uses them. Is it your case? – Luc Hermitte Jun 11 '20 at 21:12

According to :h <LocalLeader>

<LocalLeader> is just like <Leader>, except that it uses "maplocalleader" instead of "mapleader".

So you need

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.