[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 109e5b0 37/90: Bind "C-o" to hydra-ivy/body
From: |
Oleh Krehel |
Subject: |
[elpa] master 109e5b0 37/90: Bind "C-o" to hydra-ivy/body |
Date: |
Tue, 30 Jun 2015 07:28:20 +0000 |
branch: master
commit 109e5b0f1fc17333a122ba61d6c1b9cf8106bf83
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
Bind "C-o" to hydra-ivy/body
* ivy.el (ivy-minibuffer-map): Update.
* ivy-hydra.el (hydra-ivy): New defhydra.
Add shortcuts:
"C-n" -> "j"
"C-p" -> "k"
"M-<" -> "h"
"M->" -> "l"
"C-j" -> "f"
"C-m" -> "d"
"C-g" -> "o"
cancel "C-o" -> "i"
toggle calling -> "c"
The hydra doesn't inhibit other bindings, so "C-v" and "M-v" also work
when you toggle calling on with "c".
---
ivy-hydra.el | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ivy.el | 1 +
2 files changed, 69 insertions(+), 0 deletions(-)
diff --git a/ivy-hydra.el b/ivy-hydra.el
new file mode 100644
index 0000000..1efab41
--- /dev/null
+++ b/ivy-hydra.el
@@ -0,0 +1,68 @@
+;;; ivy-hydra.el --- Additional key bindings for Ivy -*- lexical-binding: t
-*-
+
+;; Copyright (C) 2015 Free Software Foundation, Inc.
+
+;; Author: Oleh Krehel
+
+;; This file is part of GNU Emacs.
+
+;; This file is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; For a full copy of the GNU General Public License
+;; see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+;;
+;; This package provides the `hydra-ivy/body' command, which is a
+;; quasi-prefix map, with many useful bindings. These bindings are
+;; shorter than usual, using mostly unprefixed keys.
+
+;;; Code:
+(require 'hydra)
+(require 'ivy)
+
+(unless (package-installed-p 'hydra)
+ (defmacro defhydra (name &rest _)
+ "This is a stub for the uninstalled `hydra' package."
+ `(defun ,(intern (format "%S/body" name)) ()
+ (interactive)
+ (if (yes-or-no-p "Package `hydra' not installed. Install?")
+ (progn
+ (package-install 'hydra)
+ (save-window-excursion
+ (find-library "ivy-hydra")
+ (byte-compile-file (buffer-file-name) t)))
+ (error "Please install `hydra' and recompile/reinstall
`ivy-hydra'")))))
+
+(defhydra hydra-ivy (:hint nil
+ :color pink)
+ "
+^^^^^^ ^Yes^ ^No^ ^Maybe^
+^^^^^^^^^^^^^^---------------------------------------
+^ ^ _k_ ^ ^ _f_ollow _i_nsert _c_: calling %s(if ivy-calling \"on\"
\"off\")
+_h_ ^✜^ _l_ _d_one _o_ops
+^ ^ _j_ ^ ^
+"
+ ;; arrows
+ ("h" ivy-beginning-of-buffer)
+ ("j" ivy-next-line)
+ ("k" ivy-previous-line)
+ ("l" ivy-end-of-buffer)
+ ;; actions
+ ("o" keyboard-escape-quit :exit t)
+ ("i" nil)
+ ("f" ivy-alt-done :exit nil)
+ ("d" ivy-done :exit t)
+ ("c" ivy-toggle-calling))
+
+(provide 'ivy-hydra)
+
+;;; ivy-hydra.el ends here
diff --git a/ivy.el b/ivy.el
index 3216c4c..a2805eb 100644
--- a/ivy.el
+++ b/ivy.el
@@ -122,6 +122,7 @@ Only \"./\" and \"../\" apply here. They appear in reverse
order."
(define-key map (kbd "C-M-p") 'ivy-previous-line-and-call)
(define-key map (kbd "M-q") 'ivy-toggle-regexp-quote)
(define-key map (kbd "M-j") 'ivy-yank-word)
+ (define-key map (kbd "C-o") 'hydra-ivy/body)
map)
"Keymap used in the minibuffer.")
- [elpa] master efa751b 28/90: counsel.el (counsel-M-x): Piggyback on smex for sorting, (continued)
- [elpa] master efa751b 28/90: counsel.el (counsel-M-x): Piggyback on smex for sorting, Oleh Krehel, 2015/06/30
- [elpa] master ebead12 29/90: Add fuzzy matching function, Oleh Krehel, 2015/06/30
- [elpa] master 84e20a3 30/90: Fixup ivy-resume for file completion, Oleh Krehel, 2015/06/30
- [elpa] master d24397b 32/90: counsel.el (counsel-M-x-initial-input): New defcustom, Oleh Krehel, 2015/06/30
- [elpa] master e016d48 31/90: Allow "TAB" to complete when input starts with "^", Oleh Krehel, 2015/06/30
- [elpa] master 7f2cc7c 33/90: counsel.el: Add a bunch of autoload cookies, Oleh Krehel, 2015/06/30
- [elpa] master 165c176 34/90: counsel.el (counsel-find-file-ignore-regexp): Default to nil, Oleh Krehel, 2015/06/30
- [elpa] master 72d4c76 35/90: Replace "C-x 6" with "<f2>" in counsel-M-x, Oleh Krehel, 2015/06/30
- [elpa] master 8c3bf21 36/90: ivy-toggle-calling: Toggle calling "RET" action for current candidate, Oleh Krehel, 2015/06/30
- [elpa] master 39eb7ed 38/90: counsel.el (counsel-M-x): Call smex-initialize, Oleh Krehel, 2015/06/30
- [elpa] master 109e5b0 37/90: Bind "C-o" to hydra-ivy/body,
Oleh Krehel <=
- [elpa] master 7dea8b7 39/90: ivy.el (hydra-ivy/body): Autoload, Oleh Krehel, 2015/06/30
- [elpa] master 9ceb7ee 42/90: Fix yank/undo bug, Oleh Krehel, 2015/06/30
- [elpa] master d8172a0 40/90: ivy.el (ivy--regex-fuzzy): Improve for "^" and "$", Oleh Krehel, 2015/06/30
- [elpa] master 02cedb7 43/90: ivy.el (ivy-insert-current): Add and bind to "M-i", Oleh Krehel, 2015/06/30
- [elpa] master 1a5b259 44/90: Fix the minibuffer being too small with enough candidates, Oleh Krehel, 2015/06/30
- [elpa] master e334a75 45/90: ivy.el (ivy-initial-inputs-alist): Add man and woman, Oleh Krehel, 2015/06/30
- [elpa] master ae05765 41/90: Allow to customize the initial input for all commands, Oleh Krehel, 2015/06/30
- [elpa] master 4d66758 47/90: Allow to toggle matching mode with "C-o m", Oleh Krehel, 2015/06/30
- [elpa] master 16fefbc 48/90: ivy-hydra.el (hydra-ivy): Add "C-j" and "C-m" exit points, Oleh Krehel, 2015/06/30
- [elpa] master 7945ab0 49/90: counsel.el (counsel-M-x): Call smex-rank, Oleh Krehel, 2015/06/30