I wanted to bind M-n to transpose-chars in evil insert state, and tried (define-key evil-insert-state-map "M-n" 'transpose-chars) But that didn't work. What should I do?

  • Try (define-key evil-insert-state-map (kbd "M-n") 'transpose-chars). Aug 16, 2016 at 15:51
  • This has got to be a duplicate question. Hope someone will find the dup...
    – Drew
    Aug 16, 2016 at 16:04

1 Answer 1


In (define-key KEYMAP KEY DEF) the KEY is internal representation of keys, where prefix keys must be \C- or \M-. A way to convert keys into internal representation is to use (kbd KEYS) function, where KEYS is string. In your question it could be two variants:

  • (define-key evil-insert-state-ma‌​p "\M-n" 'transpose-chars)
  • (define-key evil-insert-state-ma‌​p (kbd "M-n") 'transpose-chars)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.