I would like to assign evil-mode normal-state key bindings dependent on what major mode I am currently working in.

E.g. I am using org-mode and I want a set of keys and if I use AucTeX I want a different set of keys. Potentially there are keys that behave differently under different major modes because I want to keep a certain naming logic.

I tried assigning keys using different minor-modes, however the last loaded minor-mode overwrites the previously assigned key bindings. Switching to a different window with a different major mode does not switch the key bindings back.

  • Could you please close the question if it worked?
    – clemera
    Commented Dec 9, 2015 at 12:21

1 Answer 1


You can use evil-define-key.

For example to bind "a" in normal-state to different commands in org-mode and emacs-lisp-mode, you would do:

(evil-define-key 'normal org-mode-map "a" 'bar) 
(evil-define-key 'normal emacs-lisp-mode-map "a" 'foo) 

Now "a" in normal state is bound to command bar in org-mode and command foo in emacs-lisp-mode.

  • Super. Gonna try that. Commented Nov 23, 2015 at 16:24

Your Answer

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

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