complete-computing-environment/hydra.org

1.5 KiB

Flowing Keybindings with Hydra

(provide 'cce/hydra-base)

Hydra is an Emacs library which provides tools to build composable keybinding micro-systems. It allows you to define, basically, easily accessed minor modes such as a "window management" minor-mode, or quickly run interactive commands like toggling variables or doing text transformation, etc. It's a big hairy macro, and it works really nicely. I describe its usage in pages which link to this one.

(use-package hydra)

So for example, when I am presenting Emacs to others, when I am screensharing at work, or when I am streaming my desktop online, I want to increase my font size so that it's more legible. With hydra-zoom, I hit <SPC>zgggggl to make my font size increase by a factor of five, and then decrease it once I inevitably realize I've gone too far.

(with-eval-after-load 'evil-leader
  (defhydra hydra-zoom ()
    ("g" text-scale-increase "in")
    ("l" text-scale-decrease "out"))
  (evil-leader/set-key "z" 'hydra-zoom/body))