Give config/default keybinds higher precedence

This is highly experimental! It gives keybinds bound with `map!` much
higher precedence, allowing it to override the defaults imposed by
major modes and plugins (like evil-collection).
This commit is contained in:
Henrik Lissner 2018-03-21 22:26:56 -04:00
parent 69da6da541
commit abe42fcb9a
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
3 changed files with 19 additions and 35 deletions

View file

@ -10,6 +10,14 @@
(defvar doom-localleader-key "SPC m"
"The localleader prefix key, for major-mode specific commands.")
(defvar doom-mode-map (make-sparse-keymap)
"TODO")
(define-minor-mode doom-mode
"TODO"
:global t
:init-value t)
(defvar doom-evil-state-alist
'((?n . normal)
(?v . visual)
@ -300,17 +308,19 @@ Example
(unless (featurep 'evil)
(throw 'skip 'evil))
(dolist (state states)
(push `(define-key
,(if (eq state 'global)
'(current-global-map)
(intern (format "evil-%s-state-%smap" state (if doom--local "local-" ""))))
,key ,def)
(push (if (eq state 'global)
`(define-key doom-mode-map ,key ,def)
(if doom--local
`(evil-local-set-key ',state ,key ,def)
`(evil-define-key* ',state doom-mode-map ,key ,def)))
forms)))
(doom--keymaps
(dolist (keymap doom--keymaps)
(push `(define-key ,keymap ,key ,def) forms)))
(t
(push `(,(if doom--local #'local-set-key #'global-set-key) ,key ,def)
(push (if doom--local
`(local-set-key ,key ,def)
`(define-key doom-mode-map ,key ,def))
forms))))
(setq states '()
doom--local nil