I have a german keyboard and \ is hard to reach, so I added the following line to my config:

map ß \

This works fine for simple leader commands, and I did not have to change my leader command in case I have to use vim with a non-german keyboard.

The problem arose when I tried to use the default easymotion commands which uses a prefix of <leader><leader>. These do not work at all. Easymotion works when I use the complicated chord to actually input a \ from my keyboard.

map should work in normal, visual, select and operator pending modes, so for this not to be working, i presume that pressing the leader key does not put you in the operator pending mode covered by the map command. So what map variant do I need to use to cover the <leader><leader> sequence with ß, while keeping \ as leader?

Using neovim on ubuntu.


1 Answer 1


Vim only recognizes a recursive mapping expansion at the beginning of another mapping. Once it's started recognizing another mapping, it will try to match the characters of the mapping verbatim, so it will ignore mappings such as map ß \ for the \ as the second (or third, etc.) character.

You can work around that by setting up a second mapping for the double prefix:

map ß \
map ßß \\

As long as you don't have a mapping for <Leader> by itself, you only use it as a prefix for other mappings, which is the normal usage, that should work just fine.

That way, when you type the first ß, Vim will wait to see if it can match the second mapping. If you type anything other than ß, Vim will expand the first mapping and expand to <Leader> followed by the second character, which will be matched to existing <Leader> mappings again.

If you do type ßß, Vim will expand it to the double <Leader> which will match the mappings that use them as a prefix.

  • 1
    I wonder if langmap is a better solution here ? Not too familiar with it though
    – D. Ben Knoble
    Commented Sep 24, 2020 at 12:52

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.