Skip to content
Felipe Lema edited this page Dec 14, 2018 · 2 revisions

Using Hydra for Leader Key

An alternative approach to emulate the leader key is using hydra: you can (recursively) map prefixed keys to a hydra, avoiding the boiler plate of having to create a map with (make-sparse-keymap) while getting a custom help message.

(defhydra my-hydra (:exit t)
  "My hydra"
  ("b" list-buffers "list-buffers"))
(define-key evil-normal-state-map "\\"
  (lambda ()
    (interactive)
    (evil-without-repeat
      (call-interactively #'my-hydra/body))))

You must use the evil-without-repeat macro to call the hydra, as you prevent the latter being called when using . for evil-repeat.

Clone this wiki locally