How do I make ae
in evil insert mode produce æ
?
This would be the equivalent of inoremap ae æ
in vim.
(I tried
(define-key evil-insert-state-map (kbd "ae") (kbd "\C-kae"))
,
but after this typing a
(without an e
after it) didn't
produce an a
, but rather the error a is undefined
.)
2 Answers
You could try something like
(add-hook 'post-self-insert-hook
(lambda ()
(and (eq last-command-event ?e)
(looking-back "ae" (- (point) 2))
(replace-match "æ"))))
-
Thanks! there is no timeout on this. how would I escape to produce 'ae'?– ToothrotJul 28, 2016 at 18:34
-
have a look at the key-chord
emacs package. it allows you to define mappings of multiple keys and take action on them. in your case the action would just be (insert "æ")
.
alternatively, insert a digraph by typing C-k a e
in evil's insert mode. this invokes (evil-insert-digraph)
and reads a
and e
, then produces æ.
-
C-k
doesn't give me any digraph here. Could you explain what you mean? Is that part of the key-chord package.– StefanJul 28, 2016 at 19:23 -
(define-key evil-insert-state-map (kbd "ae") "æ")
?abbrev-mode
than for a function. See, for example, emacs.stackexchange.com/questions/7435/….