Can I run a command just after hitting a prefix?
Opened this issue · 1 comments
alienbogart commented
Runtime Environment
- OS: MX Linux 18.3
- i3 version 4.13 (2016-11-08)
- i3/config
- dotfiles
- GNU Emacs 27.0.50
- Org mode version 9.2.3
- Evil version 1.2.14
- ~/.emacs.d
Issue
Let's say I have the following:
(general-define-key
:prefix "<escape>"
:states '(normal visual)
:keymaps 'override
"<escape>" 'save-some-buffers)
By hitting escape twice, save-some-buffers
will be executed, which is fine. But what if I also wanted a command to run by the time I hit the first escape? Something like evil-ex-nohighlight
, for example? Would that feasible?
noctuid commented
If you always want the first action to happen, I'd suggest binding the key to a hydra, and running whatever you want in the setup (evil-ex-nohighlight
for this example).
You could also use general-key-dispatch
with :timeout
, so that if you didn't press the second escape within a certain timeframe, it would call evil-ex-nohighlight
. If you pressed it within the time frame, it would call save-some-buffers
.