complete-computing-environment/hydra.org

35 lines
1.5 KiB
Org Mode

:PROPERTIES:
:ID: cce/hydra
:ROAM_ALIASES: Hydra
:END:
#+TITLE: Flowing Keybindings with Hydra
#+filetags: :CCE:Emacs:Code:
#+PROPERTY: header-args :mkdirp yes :results none
#+PROPERTY: header-args:emacs-lisp :tangle hydra-base.el
#+ARROYO_EMACS_MODULE: hydra-base
#+ARCOLOGY_KEY: cce/hydra-base
#+ARCOLOGY_ALLOW_CRAWL: t
#+CCE_PREDICATE: t
#+CCE_PRIORITY: 01
#+ARROYO_MODULE_WANTS: cce/evil_mode.org
#+begin_src emacs-lisp
(provide 'cce/hydra-base)
#+end_src
Hydra is an [[id:cce/emacs][Emacs]] library which provides tools to build composable keybinding micro-systems. It allows you to define, basically, easily accessed minor modes such as a "[[https://github.com/abo-abo/hydra/wiki/Window-Management][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.
#+begin_src emacs-lisp
(use-package hydra)
#+end_src
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.
#+begin_src emacs-lisp
(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))
#+END_SRC