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

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

[elpa] master 378ee58 03/18: Add "C-v" and "M-v" scrolling


From: Oleh Krehel
Subject: [elpa] master 378ee58 03/18: Add "C-v" and "M-v" scrolling
Date: Mon, 20 Apr 2015 12:39:02 +0000

branch: master
commit 378ee5849d426c92ec30fc28f0280ee9ee197025
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    Add "C-v" and "M-v" scrolling
    
    * ivy.el (ivy-minibuffer-map): Update.
    (ivy-scroll-up-command): New defun.
    (ivy-scroll-down-command): New defun.
---
 ivy.el |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/ivy.el b/ivy.el
index 8f8f63a..bd43883 100644
--- a/ivy.el
+++ b/ivy.el
@@ -87,6 +87,8 @@ Only \"./\" and \"../\" apply here. They appear in reverse 
order."
     (define-key map (kbd "M-n") 'ivy-next-history-element)
     (define-key map (kbd "M-p") 'ivy-previous-history-element)
     (define-key map (kbd "C-g") 'minibuffer-keyboard-quit)
+    (define-key map (kbd "C-v") 'ivy-scroll-up-command)
+    (define-key map (kbd "M-v") 'ivy-scroll-down-command)
     map)
   "Keymap used in the minibuffer.")
 
@@ -185,6 +187,18 @@ When non-nil, it should contain one %d.")
   (interactive)
   (setq ivy--index (1- ivy--length)))
 
+(defun ivy-scroll-up-command ()
+  "Scroll the candidates upward by the minibuffer height."
+  (interactive)
+  (setq ivy--index (min (+ ivy--index ivy-height)
+                        (1- ivy--length))))
+
+(defun ivy-scroll-down-command ()
+  "Scroll the candidates downward by the minibuffer height."
+  (interactive)
+  (setq ivy--index (max (- ivy--index ivy-height)
+                        0)))
+
 (defun ivy-next-line (&optional arg)
   "Move cursor vertically down ARG candidates."
   (interactive "p")



reply via email to

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