-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for repeat-map #552
Comments
I don't plan an adding any new significant features to general but would accept a PR. There are various packages meant to simplify this (define-repeat-map, repeaters, etc.), though I haven't tried any of them and don't know if any will simplify your use case. Currently, yes, it will have to be two steps. Maybe a slightly better alternative if the repeat map is a subset of what you want to bind under |
(add-to-list 'general-extended-def-keywords ':repeat-map)
(defun general-extended-def-:repeat-map (_state _keymap _key edef kargs)
"Use `put` to set the :repeat-map property for commands.
The repeat property should be specified with :repeat-map in either EDEF or KARGS."
(general-with-eval-after-load 'evil
(let ((repeat-map-property (general--getf edef kargs :repeat-map))
(command (cl-getf edef :def)))
(put command 'repeat-map repeat-map-property)))) For me, this just works... Example usage: (use-package emacs
:after org
:general-config
( :keymaps '(outline-mode-map
outline-minor-mode-map)
:states '(normal visual insert)
:repeat-map 'structural-movement-map
[remap structural-up] 'my/outline-backward-heading
[remap structural-down] 'my/outline-forward-heading
[remap structural-left] 'outline-up-heading
[remap structural-right] 'my/outline-down-heading))
I don't know whether this is a good or useful way... and I am looking into a way to make |
Does general.el provide any support for Emacs's
repeat-map
? If not, would you consider supporting it? (I understand there is a rewrite coming which may affect appetite for new features.)general.el does have a
:repeat
property but AFAICT this only applies to Evil-style keybindings. I would love to be able to specify something like the following:And have the
:repeat
property result in theflymake-goto-next-error
andflymake-goto-prev-error
be added torepeat-map
such that then
andp
keys could repeatedly invoke them.Currently I'm using
general-def
(or a custom definer) to bind the keys to the regular keymap and then duplicating the repeatable keys in another keymap that I then map intorepeat-map
and it feels like there should be a more efficient way of doing this using general.el (if there already is a way, please point me to it).Thank you.
The text was updated successfully, but these errors were encountered: