-
If I have a prefix like Of course, I can simply define every single key with the command it normally binds to, e.g., for the standard evil-mode commands, something like this: ["Very Evil"
:hide always
[("y" "y" evil-yank)
("d" "d" evil-delete)
("x" "x" evil-delete-char)
("p" "p" evil-paste-after)
("P" "P" evil-paste-before)
...]] This works, and it's nice, because this way I can even selectively set some of them to be with I'm wondering though if there's more succinct way of achieving something like that? Because this list can grow pretty quickly for the thing I'm hoping to achieve, besides, it complicates it slightly for the "prefix" type of keys, like "C-x" or "C-c", or for an evil-mode use-case example - "g". |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Oh, turns out, that is fairly simple with :setup-children
(lambda (_)
(transient-parse-suffixes
'expreg-transient
(mapcar
(lambda (key-map)
(let* ((s? (stringp key-map))
(key (if s? key-map (car key-map)))
(cmd (if s?
(lambda ()
(interactive)
(setq unread-command-events (listify-key-sequence (kbd key))))
(cadr key-map)))
(transient? (and (not s?) (caddr key-map) t)))
(list key
(format "%s" key)
cmd
:transient transient?)))
'("y" "d" "x" "p" "P" "r" "c" "R" "C-;"
">" "<" "=" "~"
("s" evil-surround-region)
("o" exchange-point-and-mark :transient)
("0" evil-beginning-of-line :transient)
("$" evil-end-of-line :transient) |
Beta Was this translation helpful? Give feedback.
Oh, turns out, that is fairly simple with
:setup-children
, e.g.: