0

Sorry for what is probably an easy question for an experienced emacs user, I'm having a really hard time figuring out how to switch the default bindings for the ESC and "`" keys.

This is what I have so far:

(defun set-my-key-bindings ()
    ;; This next line works, makes ` the escape key in insert node.
    (define-key evil-insert-state-map (kbd "`") 'evil-normal-state))
    ;; This doesn't do anything, but I want it to insert a "`" character when the escape key is pressed while in insert mode.
    (define-key evil-insert-state-map (kbd "ESC") (lambda () (interactive) (insert "`")))

Should I be approaching this differently? It seems everything I'm finding always binds a key to a emacs symbol, but the best I can find is the (self-insert-command) when I do C-H k "`" while in insert mode.

Any help greatly appreciated!!

Short
  • 7,767
  • 2
  • 25
  • 33
  • The problem is that escape is mapped to a keymap in evil (evil-esc-map), and it's a bit tricky to intercept since emacs always wants it to be a prefix key. it may make sense for you to remap your keyboard using xmodmap or similar? – Woodrow Douglass Dec 23 '15 at 14:43
  • Is it possible to unbind escape from doing this? – Short Dec 23 '15 at 15:23

0 Answers0