From 8e36acc07d62b76d6da7866c45a7d3214ae68a37 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Fri, 30 Apr 2021 11:36:00 -0500 Subject: 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. --- init.el | 18 +++++++++++++++--- 1 file 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'." (setup (:straight which-key) (:option which-key-show-early-on-C-h t - which-key-idle-delay 10000 - which-key-idle-secondary-delay 0.05) - (which-key-setup-side-window-bottom) + which-key-idle-delay 0.05 + which-key-idle-secondary-delay 0.05 + which-key-delay-functions '(acdw/which-key-delay-all-but)) + + (defun acdw/which-key-delay-all-but (seq len) + "Delay all `which-key' popups, /except/ the ones here." + (cond + ;; With C-z binds (`acdw/leader'), pop up right away + ((string-prefix-p "C-z" seq :ignore-case) 0) + ;; Also pop up right away if we're already entering keys + ((> len 1) 0) + ;; Otherwise, wait 1.25 seconds + (t 1.25))) + + (which-key-setup-minibuffer) (which-key-mode +1)) (setup (:straight zzz-to-char) -- cgit 1.4.1-21-gabe81