about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2021-04-30 11:36:00 -0500
committerCase Duckworth2021-04-30 11:38:24 -0500
commit8e36acc07d62b76d6da7866c45a7d3214ae68a37 (patch)
treefcfdb48ab121ac83aaa524c2e0e2a7179f29124c
parentInhibit loading X Resources (diff)
downloademacs-8e36acc07d62b76d6da7866c45a7d3214ae68a37.tar.gz
emacs-8e36acc07d62b76d6da7866c45a7d3214ae68a37.zip
Change which-key popup delay
I found out about `which-key-delay-functions', which lets me tweak the delay
depending on what the key sequence is.  I set up a function to show bindings in
my "leader map" immediately, but to delay for a bit on everything else.

I also put which-key stuff in the minibuffer -- I think it looks pretty good.
-rw-r--r--init.el18
1 files changed, 15 insertions, 3 deletions
diff --git a/init.el b/init.el index 8b9a086..0a82bfd 100644 --- a/init.el +++ b/init.el
@@ -982,9 +982,21 @@ if ripgrep is installed, otherwise `consult-grep'."
982 982
983(setup (:straight which-key) 983(setup (:straight which-key)
984 (:option which-key-show-early-on-C-h t 984 (:option which-key-show-early-on-C-h t
985 which-key-idle-delay 10000 985 which-key-idle-delay 0.05
986 which-key-idle-secondary-delay 0.05) 986 which-key-idle-secondary-delay 0.05
987 (which-key-setup-side-window-bottom) 987 which-key-delay-functions '(acdw/which-key-delay-all-but))
988
989 (defun acdw/which-key-delay-all-but (seq len)
990 "Delay all `which-key' popups, /except/ the ones here."
991 (cond
992 ;; With C-z binds (`acdw/leader'), pop up right away
993 ((string-prefix-p "C-z" seq :ignore-case) 0)
994 ;; Also pop up right away if we're already entering keys
995 ((> len 1) 0)
996 ;; Otherwise, wait 1.25 seconds
997 (t 1.25)))
998
999 (which-key-setup-minibuffer)
988 (which-key-mode +1)) 1000 (which-key-mode +1))
989 1001
990(setup (:straight zzz-to-char) 1002(setup (:straight zzz-to-char)