Hi is there a way to map German umlaute like "ö", "ä", "ü" to some keyboard shortcut, i.e. when I press the keyboard shortcut, it inserts the umlaut.
I am German and use an English keyboard layout, but sometimes write in German.
Thanks
Vi and Vim Stack Exchange is a question and answer site for people using the vi and Vim families of text editors. It only takes a minute to sign up.
Sign up to join this communityHi is there a way to map German umlaute like "ö", "ä", "ü" to some keyboard shortcut, i.e. when I press the keyboard shortcut, it inserts the umlaut.
I am German and use an English keyboard layout, but sometimes write in German.
Thanks
You might want to look into digraphs, which give you a built-in solution to accents and umlauts in Vim.
For umlauted "u" you can type:
Ctrl+K, :, u
Or:
Ctrl+K, u, :
See :help digraphs-use
for using digraphs, or :help digraphs-default
for a very comprehensive list of the digraphs defined by default that you can use. (You will find umlaut is listed as Diaeresis in that list.)
alt+:
in insert mode?
inoremap <M-:> <C-k>:
will do what you suggest, but note that alt-:
doesn't really work in most terminals, only on a GUI version of Vim, so you might not be able to use that particular mapping in your specific setup... (I'd prefer leaving that out of the answer mostly because using something like alt+:
will be unreliable. Also, your question asked about "some keyboard shortcut" and Ctrl+K
, :
fits that role, so it's valid and complete as an answer. It also works everywhere, no need for any setup.)