Add :g switch to map! #249
This commit is contained in:
parent
9a959e73bc
commit
19ca683f86
1 changed files with 15 additions and 7 deletions
|
@ -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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue