-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Keymaps guide
Fabien Dubosson edited this page Dec 19, 2015
·
6 revisions
This is the nearly complete hierarchy for Emacs keymaps when used with evil (vim emulation). Emacs will search for a binding for whatever key you press starting from the top and working down, until it finds a valid binding. That means a key can currently have multiple bindings, but only the one with the highest priority is ever used. You do not need to remember all of this, but it’s helpful to have it here in case you can’t figure out why the key you bound is not available.
-
Overriding keymaps/overlay keymaps
-
Examples:
- magit section maps
- micro states
-
Examples:
-
Emulation mode keymaps
- Non-evil emulation-mode-maps
- Used to elevate minor mode maps
-
Examples:
- bind-map keys (not evil-keys) with override option
- also
bind-key*
puts things here
- Evil Intercept keymaps
- Used to handle ESC in evil
-
Command:
(evil-make-intercept-map map)
- etc.
- Evil Local state keymap
- Used by evil-leader
-
Command:
(define-key evil-normal-state-local-map key def)
-
Maps:
evil-normal-state-local-map
evil-insert-state-local-map
- Example: currently used by bind-map for evil keys with override-mode-maps option (chosen to emulate evil-leader priority)
- Evil Auxiliary keymaps
- Used if you define minor-mode and evil-state specific keys (lots of examples)
-
Command:
(evil-define-key state mode-map key def)
- Example: bind-map evil-keys tied to a minor-mode
- Evil Overriding keymaps
- Used to put minor mode maps ahead of evil global maps
-
Command:
(evil-make-overriding-map map)
- Example: Dired-mode-map for example is here
- Evil Global state keymap
- “most” of the vim keybindings are here
-
Commands:
(evil-global-set-key state key def)
(define-key evil-normal-state-map key def)
-
Maps:
evil-normal-state-map
evil-insert-state-map
- etc.
-
Examples:
- bind-map evil-keys without override option
- Non-evil emulation-mode-maps
-
Minor mode keymaps
- All the minor mode maps that are set up without using evil functionality
- Example: bind-map keys tied to minor-mode and major-mode
-
Local keymap
-
Command:
(local-set-key key def)
- Example: major mode maps are here I believe
-
Command:
-
Global keymap
-
Command:
(global-set-key key def)
-
Map:
global-map
- Example: bind-map keys default location
-
Command:
Thanks to @justbur for this guide.