SPC SPC as a leader key initialization Even in Insert state/mode or the Emacs Input mode.
High-Flyer opened this issue ยท 4 comments
Greetings,
Following is my config how can I add "SPC SPC" as my second global-prefix to access my leader key inside insert state / mode restricted by some timeout?
(general-create-definer gm/leader-keys
:states '(normal insert visual emacs)
:keymaps 'override
:prefix "SPC" ;; set leader
:global-prefix "M-SPC") ;; access leader in insert mode
Taking inspiration from illustrated block below;
;; exmple block to exit insert moder with the keys which will be active inside insert mode.
(general-imap "j"
(general-key-dispatch 'self-insert-command
:timeout 0.25
"k" 'evil-normal-state))
Thank you, Warm regards.
You can have your definer use a :prefix-map
and only binds in normal/visual. You can then then bind SPC
in insert/emacs to a general-key-dispatch
that binds SPC
to that prefix keymap.
Thank you very much for the reply.
If I may ask,
;; So the new block will look like,
(general-create-definer gm/leader-keys
:states '(normal visual)
:keymaps 'override
:prefix "SPC" ;; set leader
:global-prefix "M-SPC") ;; access leader in insert mode
;; and the edited dispatcher block for the insert and emacs mode:
(general-imap "SPC"
(general-key-dispatch 'self-insert-command
:timeout 0.25
"SPC" 'evil-normal-state))
Am safe to assume this is what you meant ?
Apologies Am very new new to Emacs, from non programming background.
Regards
It depends on what you want. If you want to be able to run a command with SPC a
in normal state or with SPC SPC a
in insert state, you can do something like this:
(general-create-definer gm/leader-keys
:states '(normal visual)
:keymaps 'override
:prefix "SPC"
:prefix-map 'gm-leader-prefix-map)
(gm/leader-keys "a" #'test)
(general-def '(insert emacs)
"SPC" (general-key-dispatch 'self-insert-command
:timeout 0.25
"SPC" gm-leader-prefix-map))
Thank you Very much for the package kind and explaining reply.
And contributing in this: Emacs/Evil for Vim Users
Much appreciated
Warm Regards o7