[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 7876619 61/67: Update "C-n" and "C-p" bindings
From: |
Oleh Krehel |
Subject: |
[elpa] master 7876619 61/67: Update "C-n" and "C-p" bindings |
Date: |
Sun, 22 Mar 2015 17:34:11 +0000 |
branch: master
commit 78766192b4121d7782372572c55e7eefcb055f7d
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
Update "C-n" and "C-p" bindings
* ivy.el (ivy-next-line): Don't touch history.
(ivy-next-line-or-history): Select previous history element if there's
no input.
(ivy-previous-line): Don't touch history.
(ivy-previous-line-or-history): Select previous history element if
there's no input.
Re #23
---
ivy.el | 34 ++++++++++++++++++++++++----------
1 files changed, 24 insertions(+), 10 deletions(-)
diff --git a/ivy.el b/ivy.el
index 2f798ce..53f86c1 100644
--- a/ivy.el
+++ b/ivy.el
@@ -63,8 +63,8 @@ Set this to nil if you don't want the count."
(define-key map (kbd "C-m") 'ivy-done)
(define-key map (kbd "C-n") 'ivy-next-line)
(define-key map (kbd "C-p") 'ivy-previous-line)
- (define-key map (kbd "C-s") 'ivy-next-line)
- (define-key map (kbd "C-r") 'ivy-previous-line)
+ (define-key map (kbd "C-s") 'ivy-next-line-or-history)
+ (define-key map (kbd "C-r") 'ivy-previous-line-or-history)
(define-key map (kbd "SPC") 'self-insert-command)
(define-key map (kbd "DEL") 'ivy-backward-delete-char)
(define-key map (kbd "M-<") 'ivy-beginning-of-buffer)
@@ -91,14 +91,6 @@ of `history-length', which see.")
(setq ivy-exit 'done))
(exit-minibuffer))
-(defun ivy-next-line ()
- "Select the next completion candidate."
- (interactive)
- (when (string= ivy-text "")
- (ivy-previous-history-element 1))
- (unless (>= ivy--index (1- ivy--length))
- (cl-incf ivy--index)))
-
(defun ivy-beginning-of-buffer ()
"Select the first completion candidate."
(interactive)
@@ -109,9 +101,31 @@ of `history-length', which see.")
(interactive)
(setq ivy--index (1- ivy--length)))
+(defun ivy-next-line ()
+ "Select the next completion candidate."
+ (interactive)
+ (unless (>= ivy--index (1- ivy--length))
+ (cl-incf ivy--index)))
+
+(defun ivy-next-line-or-history ()
+ "Select the next completion candidate.
+If the input is empty, select the previous history element instead."
+ (interactive)
+ (when (string= ivy-text "")
+ (ivy-previous-history-element 1))
+ (unless (>= ivy--index (1- ivy--length))
+ (cl-incf ivy--index)))
+
(defun ivy-previous-line ()
"Select the previous completion candidate."
(interactive)
+ (unless (zerop ivy--index)
+ (cl-decf ivy--index)))
+
+(defun ivy-previous-line-or-history ()
+ "Select the previous completion candidate.
+If the input is empty, select the previous history element instead."
+ (interactive)
(when (string= ivy-text "")
(ivy-previous-history-element 1))
(unless (zerop ivy--index)
- [elpa] master 2b8e4e1 53/67: ivy.el: Remove while-no-input, (continued)
- [elpa] master 2b8e4e1 53/67: ivy.el: Remove while-no-input, Oleh Krehel, 2015/03/22
- [elpa] master 2191bdb 54/67: ivy.el (ivy-completions): Simplify, Oleh Krehel, 2015/03/22
- [elpa] master d587fa2 51/67: ivy.el (ivy-read): Allow for format-style PROMPT, Oleh Krehel, 2015/03/22
- [elpa] master 9f9c4dc 57/67: swiper-helm.el: Fix typo, Oleh Krehel, 2015/03/22
- [elpa] master 3a08a88 50/67: ivy.el (ivy-read): Change index to preselect, Oleh Krehel, 2015/03/22
- [elpa] master d2b2813 55/67: swiper-helm.el: Copy all helm stuff here, Oleh Krehel, 2015/03/22
- [elpa] master c4acef9 56/67: swiper.el: Remove the helm bits, Oleh Krehel, 2015/03/22
- [elpa] master 0c85d9a 58/67: Add a custom `ivy-count-format', Oleh Krehel, 2015/03/22
- [elpa] master c2e58e9 59/67: Fix invalid package header line, Oleh Krehel, 2015/03/22
- [elpa] master a275a2a 60/67: Use `font-lock-append-text-property' to non-destructively modify a, Oleh Krehel, 2015/03/22
- [elpa] master 7876619 61/67: Update "C-n" and "C-p" bindings,
Oleh Krehel <=
- [elpa] master f20b287 62/67: swiper.el (swiper--init): Set `swiper--opoint', Oleh Krehel, 2015/03/22
- [elpa] master bb6c40c 63/67: swiper.el (swiper-min-highlight): New defcustom, Oleh Krehel, 2015/03/22
- [elpa] master cf71b09 64/67: ivy.el (ivy-wrap): New defcustom, Oleh Krehel, 2015/03/22
- [elpa] master 55414c3 66/67: Update Copyright, Oleh Krehel, 2015/03/22
- [elpa] master 4358c03 65/67: Move swiper-helm to another repo, Oleh Krehel, 2015/03/22
- [elpa] master 302a16a 67/67: Add 'packages/swiper/' from commit '55414c321ca07bd86f0f1efaf8f6130617e6fad6', Oleh Krehel, 2015/03/22