Leader key on a non-evil setup
Closed this issue · 2 comments
Hi,
First of all, congratulations for this great module. I've been using it for a while and it's pretty straightforward.
I have this working configuration in an evil setup that allows me to define some shortcuts depending on the current mode:
(setq my-mode-leader1 ",")
(general-def :states '(motion) my-leader1 nil)
(general-create-definer my-mode-def
:states '(motion)
:prefix my-mode-leader1
)
(my-mode-def haskell-mode-map
"a" 'haskell-add-import
"s" 'haskell-session-change
"t" 'haskell-doc-show-type
)
(my-mode-def emacs-lisp-mode-map
"e" '(:ignore t :wk "eval")
"eb" 'eval-buffer
"el" 'eval-last-sexp
"er" 'eval-region
)
Now I'm thinking on moving from evil to a less intrusive modal layout (RYO, modalka, objed, or even a custom minor mode).
I tried objed, which defines a custom map to be user configurable:
(defvar objed-user-map
(let ((map (objed--define-prefix "'" 'objed-user-map)))
map)
"Keymap for custom user bindings.")
So I tried using that objed-user-map, but then I'm not sure which map should I pass to the definer. Because I want to modify my custom-user-map, but with different keys depending if I have a python, lisp, c, or haskell file opened.
If I try this:
(my-mode-def haskell-mode-map
"a" 'haskell-add-import
"s" 'haskell-session-change
"t" 'haskell-doc-show-type
)
I end up with those shortcuts when I'm in "insert-mode".
Is it clear what I'm trying to get? Is it possible in a non-evil setup?
Thanks for your work,
I'm not very familiar with objed, but I don't think it supports different keybindings for different major modes. If you want to do something like this, you'd probably be better off writing a helper to add to hooks (e.g. haskell-mode-hook
) to make local keybindings. Or make an issue on objed requesting support for this.
Ok, I thought it was possible through general.el. I'll check there, thanks!