justbur / emacs-which-key

Emacs package that displays available keybindings in popup
GNU General Public License v3.0
1.73k stars 87 forks source link

Provide mechanism to disable for some modes #243

Open alephnull opened 4 years ago

alephnull commented 4 years ago

Like markdown-mode already has excellent prompt support when you are editing and which-key takes it over. I tried setting up a local variable in markdown-mode-hook like:

(lambda () 
   (setq-local which-key-idle-delay 60))

and I can see that the variable is set in buffer but w-k seems to be using the default value. ANy other way of disabling also welcome.

justbur commented 4 years ago

That won't work unless you reset the timer each time you enter and exit the buffer.

You could try something like this instead

(add-hook 'which-key-delay-functions
          (lambda (_ _)
            (when (eq major-mode 'markdown-mode)
              1000))
          nil t)
a13 commented 3 years ago

@alephnull you can set markdown-enable-prefix-prompts to nil instead :)

betaprior commented 2 years ago

The which-key-delay-functions trick works well and is very helpful for me in vterm. Add this to the docs maybe?

torgeir commented 1 year ago

Seconded on the delay functions trick as a solution in vterm, though I feel a list of disabled modes would be a cleaner solution.

Here's my take on a 2s added delay to make evil and leader keybindings work in vterm with doom emacs without which-key interfering with the cursor placement.

(after! which-key
  (defun t/delayed-which-key (_ _)
    (cond
     ((eq major-mode 'vterm-mode) 2)
     (t nil)))
  (add-hook! 'which-key-delay-functions #'t/delayed-which-key))