I'm using evil mode.

I'm looking for a convenient way to type German language Umlaut characters (ä, ü, ö, Ä, Ü, Ö, ß) while using an English US keyboard layout. One idea that came to mind was to have triple key presses insert these characters, e.g., pressing aaa would insert ä, OOO would insert Ö, SSS would insert ß, and so on.

This should of course only happen while in insert state.

Unfortunately, I have no idea how to accomplish this - any help is greatly appreciated!

5 Answers 5


Not a direct answer to your question of how to have tripled keys insert certain characters, but have you tried using an input method? For example, C-x RET C-\ german.

An input method is a typical way to use a keyboard to insert characters for a different language.

C-x RET C-\ (translated from C-x <return> C-\) runs the command set-input-method (found in global-map), which is an interactive compiled Lisp function in mule-cmds.el.

It is bound to C-x RET C-\, menu-bar options mule set-input-method.

(set-input-method INPUT-METHOD &optional INTERACTIVE)

Select and activate input method INPUT-METHOD for the current buffer.

This also sets the default input method to the one you specify. If INPUT-METHOD is nil, this function turns off the input method, and also causes you to be prompted for a name of an input method the next time you invoke C-\. When called interactively, the optional arg INTERACTIVE is non-nil, which marks the variable default-input-method as set for Custom buffers.

To deactivate the input method interactively, use C-\. To deactivate it programmatically, use deactivate-input-method.


You could make the third keypress do what you want like this:

(defun insert-a-or-umlaut ()
    (if (looking-back "aa")
          (backward-delete-char 2)
          (insert "ä"))
      (self-insert-command 1))))

(global-set-key "a" 'insert-a-or-umlaut)

To get the others you can modify this pattern. In order to do this using evil and only in insert-mode you will have to bind the command in a different way.


I would try something like yasnippets:

(yas-define-snippets 'org-mode
             '(("aa" "ä")
               ("SS" "ß")))

Then you type aa and press tab, and it is converted to ä. Or you could make them more mnemonic, eg :a.

I tried this with abbrevs, but you have to type C-x ' after aaa to get it to expand before typing the next letter.

  • Thanks! However, having to manually expand with TAB would be rather intrusive to fast typing. I would very much prefer a solution which auto-expands without an additional keypress.
    – andreas-h
    Jan 13, 2019 at 20:58

You could use key-chord. I'm not suggesting it's a good idea, but it can be done.

It doesn't seem like key-chord allows for triple-letter combinations, but you could use an uncommon character as a "prefix" and then adjust the delay timer. If you still want to write both characters in sequence without replacement, type slower than the delay timer.

(require 'key-chord)
(key-chord-mode 1)

;; Define a key-chord only for evil insert mode.  When ";u" is typed,
;; call the unnamed function (i.e. the lambda) which in turn calls the
;; insert command for the given character.  The rest is just syntax
;; specifics.  Refer to An Introduction to Programming in Emacs Lisp
;; for more information.
(key-chord-define evil-insert-state-map ";u" '(lambda() (interactive)(insert "ü")))
(key-chord-define evil-insert-state-map ";o" '(lambda() (interactive)(insert "ö")))

;; Max time delay between two key presses to be considered a key chord
(setq key-chord-two-keys-delay 0.3) ; default 0.1

;; Entering --INSERT-- mode
He liked glam bands like M;otley Cr;ue. ;; typing slowly
He liked glam bands like Mötley Crüe.   ;; typing quickly

Reference: An Introduction to Programming in Emacs Lisp


Not actually addressing "three keystrokes for inputting non-ascii characters", but "inputting non-ascii characters in few strokes".

Evil comes with nvim's digraphs.

In your case, in INSERT, you'd type Ctrl-k and then:

  • a and then : for ä
  • u: for ü
  • o: for ö
  • A: for Ä
  • U: for Ü
  • O: for Ö
  • ss for ß

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.