1 ;;; ivy-hydra.el --- Additional key bindings for Ivy -*- lexical-binding: t -*-
3 ;; Copyright (C) 2015 Free Software Foundation, Inc.
7 ;; This file is part of GNU Emacs.
9 ;; This file is free software; you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation; either version 3, or (at your option)
14 ;; This program is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
19 ;; For a full copy of the GNU General Public License
20 ;; see <http://www.gnu.org/licenses/>.
24 ;; This package provides the `hydra-ivy/body' command, which is a
25 ;; quasi-prefix map, with many useful bindings. These bindings are
26 ;; shorter than usual, using mostly unprefixed keys.
29 (require 'hydra nil t)
33 (unless (or (featurep 'hydra) (package-installed-p 'hydra))
34 (defmacro defhydra (name &rest _)
35 "This is a stub for the uninstalled `hydra' package."
36 `(defun ,(intern (format "%S/body" name)) ()
38 (let ((enable-recursive-minibuffers t))
39 (if (yes-or-no-p "Package `hydra' not installed. Install?")
41 (package-install 'hydra)
42 (save-window-excursion
43 (find-library "ivy-hydra")
44 (byte-compile-file (buffer-file-name) t)))
45 (error "Please install `hydra' and recompile/reinstall `ivy-hydra'")))))))
47 (defhydra hydra-ivy (:hint nil
50 ^^^^^^ ^Yes^ ^No^ ^Maybe^ ^Action^
51 ^^^^^^^^^^^^^^---------------------------------------------------
52 ^ ^ _k_ ^ ^ _f_ollow _i_nsert _c_: calling %s(if ivy-calling \"on\" \"off\") _w_/_s_: %s(ivy-action-name)
53 _h_ ^+^ _l_ _d_one _o_ops _m_: matcher %s(if (eq ivy--regex-function 'ivy--regex-fuzzy) \"fuzzy\" \"ivy\")
54 ^ ^ _j_ ^ ^ _g_o ^ ^ _<_/_>_: shrink/grow window
57 ("h" ivy-beginning-of-buffer)
59 ("k" ivy-previous-line)
60 ("l" ivy-end-of-buffer)
62 ("o" keyboard-escape-quit :exit t)
63 ("C-g" keyboard-escape-quit :exit t)
66 ("f" ivy-alt-done :exit nil)
67 ("C-j" ivy-alt-done :exit nil)
68 ("d" ivy-done :exit t)
70 ("C-m" ivy-done :exit t)
71 ("c" ivy-toggle-calling)
72 ("m" ivy-toggle-fuzzy)
73 (">" ivy-minibuffer-grow)
74 ("<" ivy-minibuffer-shrink)
76 ("s" ivy-next-action))
80 ;;; ivy-hydra.el ends here