command. This makes the Hydra very seamless, it's like a minor mode
that disables itself auto-magically.
-## Simplified usage
-
-Here's how to quickly bind the examples bundled with Hydra:
+## Sample global Hydras
+### Zoom
```cl
-(require 'hydra-examples)
-(hydra-create "C-M-y" hydra-example-move-window-splitter)
-(hydra-create "M-g" hydra-example-goto-error)
-(hydra-create "<f2>" hydra-example-text-scale)
+(defhydra hydra-zoom (global-map "<f2>")
+ "zoom"
+ ("g" text-scale-increase "in")
+ ("l" text-scale-decrease "out"))
```
-## Using Hydra for global bindings
+### Goto-error
-But it's much better to just take the examples as a template and write
-down everything explicitly:
+```cl
+(defhydra hydra-error (global-map "M-g")
+ "goto-error"
+ ("h" first-error "first")
+ ("j" next-error "next")
+ ("k" previous-error "prev")
+ ("v" recenter-top-bottom "recenter")
+ ("q" nil "quit"))
+```
+
+### Splitter
```cl
-(defhydra hydra-zoom (global-map "<f2>")
- "zoom"
- ("g" text-scale-increase "in")
- ("l" text-scale-decrease "out"))
+(require 'hydra-examples)
+(defhydra hydra-splitter (global-map "C-M-s")
+ "splitter"
+ ("h" hydra-move-splitter-left)
+ ("j" hydra-move-splitter-down)
+ ("k" hydra-move-splitter-up)
+ ("l" hydra-move-splitter-right))
```
+## Using the functions generated by `defhydra`
+
With the example above, you can e.g.:
```cl
though certain bindings is less than the cost of accidentally exiting a red Hydra by
pressing the wrong prefix.
-Note that it does not make sense to define a singe amaranth head, so this color can only
+Note that it does not make sense to define a single amaranth head, so this color can only
be assigned to the body. An amaranth body will always have some amaranth heads and some
blue heads (otherwise, it's impossible to exit), no reds.
+
+## Generate simple lambdas in-place:
+
+Since version `0.9.0` it's possible to pass a single sexp instead of a function name or a lambda
+to a head. This sexp will be wrapped in an interactive lambda. Here's an example:
+
+```cl
+(defhydra hydra-launcher (:color blue)
+ "Launch"
+ ("h" man "man")
+ ("r" (browse-url "http://www.reddit.com/r/emacs/") "reddit")
+ ("w" (browse-url "http://www.emacswiki.org/") "emacswiki")
+ ("s" shell "shell")
+ ("q" nil "cancel"))
+(global-set-key (kbd "C-c r") 'hydra-launcher/body)
+```