branch: master commit 0712a436f0a98980cb973c83593bfb003d097d3c Author: Oleh Krehel <ohwoeo...@gmail.com> Commit: Oleh Krehel <ohwoeo...@gmail.com>
README.md: update --- README.md | 41 +++++++++++++++++++++++++++-------------- 1 files changed, 27 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 400a4ed..831dbb6 100644 --- a/README.md +++ b/README.md @@ -16,29 +16,42 @@ Hydra, will still serve his orignal purpose, calling his proper 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