I'm trying to put together a config of my own after having used Spacemacs for a few years. To customize keybindings, and make them a bit Spacemacs-like, I'm trying out general.el. So far it seems to work rather well, except for one thing where the integration with
which-key isn't quite as I'd hoped. On the other hand, I might just be doing it wrong.
In order to get multi-key bindings, like
SPC E y to visit my yasnippet files, I've first created a "definer" with
SPC as the leader key
(general-create-definer mes/leader-def :keymaps '(normal insert visual emacs) :prefix "SPC" :non-normal-prefix "M-SPC")
using that I then define the next level,
E in this case
(mes/leader-def :infix "E" "" '(:ignore t :wk "Emacs") "y" '(:keymap mes-yasnippet-map :wk "yasnippet"))
The definition of
'mes-yasnippet-map looks like this (I did a bit of reading on keybindings/keymaps and this seems to be a reasonable way of doing it)
(define-prefix-command 'mes-yasnippet-map) (general-def :keymaps 'mes-yasnippet-map "v" '(yas-visit-snippet-file :wk "visit snippet"))
SPC I'll first see "E -> Emacs", then pressing
E I'll see "y -> yasnippet", then pressing
y I expected to see "v -> visit snippet" but instead I see "v -> yas-visit-snippet-file".
First of all, is this a good way of defining Spacemacs-like keybindings using
general.el, or is there a better way?
Second, if this is a good way, how do I get
which-key to show what I want on all levels?