abo-abo / hydra

make Emacs bindings that stick around
1.84k stars 112 forks source link

Proper way to setting hydra-key-doc-function without affect other package's setting #405

Open wztdream opened 2 years ago

wztdream commented 2 years ago

I am using spacemacs, and by default spacemacs set hydra-key-doc-function to their own format

(defun spacemacs//hydra-key-doc-function (key key-width doc doc-width)
  "Custom hint documentation format for keys."
  (format (format "[%%%ds] %%%ds" key-width (- -1 doc-width))
          key doc))

But this will results annoying brackets if you use :column property in hyra, for example the code in hyra example will be:

(defhydra hydra-movement ()
  ("j" next-line "down" :column "Vertical")
  ("k" previous-line "up")
  ("l" forward-char "forward" :column "Horizontal")
  ("h" backward-char "back"))

image

We can solve this issue by setting hydra-key-doc-function to default value, but I think there is some "reason" for spacemacs to setting their own format. So here is the question is there any way to setting my own hyra format without break other package's setting, like the setting by spacemacs here?