Add :g switch to map! #249

This commit is contained in:
Henrik Lissner 2017-10-25 14:50:02 +02:00
parent 9a959e73bc
commit 19ca683f86
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -17,7 +17,8 @@
(?e . emacs) (?e . emacs)
(?o . operator) (?o . operator)
(?m . motion) (?m . motion)
(?r . replace)) (?r . replace)
(?g . global))
"A list of cons cells that map a letter to a evil state symbol.") "A list of cons cells that map a letter to a evil state symbol.")
@ -267,16 +268,23 @@ Example
forms) forms)
(throw 'skip 'local)) (throw 'skip 'local))
((and doom--keymaps states) ((and doom--keymaps states)
(unless (featurep 'evil) (throw 'skip 'evil)) (unless (featurep 'evil)
(throw 'skip 'evil))
(dolist (keymap doom--keymaps) (dolist (keymap doom--keymaps)
(push `(,(if doom--defer 'evil-define-key 'evil-define-key*) (when (memq 'global states)
',states ,keymap ,key ,def) (push `(define-key ,keymap ,key ,def) forms))
forms))) (when-let (states (delq 'global states))
(push `(,(if doom--defer 'evil-define-key 'evil-define-key*)
',states ,keymap ,key ,def)
forms))))
(states (states
(unless (featurep 'evil) (throw 'skip 'evil)) (unless (featurep 'evil)
(throw 'skip 'evil))
(dolist (state states) (dolist (state states)
(push `(define-key (push `(define-key
,(intern (format "evil-%s-state-%smap" state (if doom--local "local-" ""))) ,(if (eq state 'global)
'(current-global-map)
(intern (format "evil-%s-state-%smap" state (if doom--local "local-" ""))))
,key ,def) ,key ,def)
forms))) forms)))
(doom--keymaps (doom--keymaps