I have digraph enabled

:set digraph

I really like the digraph setting in vim, but I often find it changes my keystrokes to some foreign character without my intention. I can see that there are around 13.000 characters defined, and the chance of hitting a combination, and a backspace in between, is just too high. In the end I will only use around 10 of these characters anyway. So my question is, can I enable digraph only for a set of predefined characters? Or do I need to resort to the CTRL-k option? Or define my own mappings?

1 Answer 1


If there are literally only ten, then a simple, albeit inelegant, solution would be to leave 'digraph' switched off and just hard code the desired behaviour with ten insert mode mappings, e.g.:

:inoremap e<BS>' é
:inoremap i<BS>: ï

It's not a perfect solution, because it results in slightly delayed/odd redraw while you are halfway through typing the mapping, but at the speed most people type in insert mode you might not find it a big issue in practice.

  • Yeah, I mentioned the mapping solution myself. I tried to avoid it, but there seems to be no way around it. This solution at least has the benefit of defining my own shortcut, e.g. I could replace <BS> with <leader>.
    – pfnuesel
    Oct 15, 2018 at 13:41
  • @pfnuesel Ugh, sorry. Somehow missed that last sentence.
    – Rich
    Oct 15, 2018 at 13:44
  • For 10 digraphs that might be overkill but what about a snippet manager? You define your 10 snippets to simply insert the character you want to and this way you don't have a delay in insert mode. (But once again a snippet manager just for that isn't necessarily the best solution)
    – statox
    Oct 15, 2018 at 14:17

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.