emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master dfb41d0 016/167: Implement ivy-avy


From: Oleh Krehel
Subject: [elpa] master dfb41d0 016/167: Implement ivy-avy
Date: Tue, 08 Dec 2015 10:49:37 +0000

branch: master
commit dfb41d0ddeef32f247e658672b4cbf82834b7f0f
Author: PythonNut <address@hidden>
Commit: Oleh Krehel <address@hidden>

    Implement ivy-avy
---
 ivy.el |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/ivy.el b/ivy.el
index 8839ba6..b983db0 100644
--- a/ivy.el
+++ b/ivy.el
@@ -152,6 +152,7 @@ Only \"./\" and \"../\" apply here. They appear in reverse 
order."
     (define-key map (kbd "C-k") 'ivy-kill-line)
     (define-key map (kbd "S-SPC") 'ivy-restrict-to-matches)
     (define-key map (kbd "M-w") 'ivy-kill-ring-save)
+    (define-key map (kbd "C-'") 'ivy-avy)
     map)
   "Keymap used in the minibuffer.")
 (autoload 'hydra-ivy/body "ivy-hydra" "" t)
@@ -744,6 +745,29 @@ On error (read-only), call `ivy-on-del-error-function'."
   (setq ivy--old-re nil)
   (cl-rotatef ivy--regex-function ivy--regexp-quote))
 
+(defun ivy-avy ()
+  "Jump to one of the current ivy candidates."
+  (interactive)
+  (let* ((avy-all-windows nil)
+         (avy-background t)
+         (candidate (let ((candidates))
+                      (save-excursion
+                        (save-restriction
+                          (narrow-to-region (window-start) (window-end))
+                          (goto-char (point-min))
+                          (forward-line)
+                          (while (< (point) (point-max))
+                            (push (cons (point) (selected-window))
+                                  candidates)
+                            (forward-line))))
+                      (setq avy-action #'identity)
+                      (avy--process (nreverse candidates)
+                                    (avy--style-fn 'at-full)))))
+    (ivy-set-index (- (line-number-at-pos candidate) 2))
+    (ivy--exhibit)
+    (ivy-done)
+    (ivy-call)))
+
 (defun ivy-sort-file-function-default (x y)
   "Compare two files X and Y.
 Prioritize directories."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]