[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ivy 8fb081a 2/3: Make "C-r" key in swiper-isearch more
From: |
Basil L. Contovounesios |
Subject: |
[elpa] externals/ivy 8fb081a 2/3: Make "C-r" key in swiper-isearch more useful |
Date: |
Sun, 4 Apr 2021 09:13:26 -0400 (EDT) |
branch: externals/ivy
commit 8fb081a0df4612dc177923b9bb4806d86de82c4c
Author: daanturo <dantle.v01@gmail.com>
Commit: Basil L. Contovounesios <contovob@tcd.ie>
Make "C-r" key in swiper-isearch more useful
* swiper.el (swiper-isearch-C-r): New command that partially mimics
vanilla isearch behavior: if the input is empty, search for previous
history; otherwise move to the previous match (PR #2840).
(swiper-isearch-map): Overwrite default "C-r" binding with it.
Copyright-paperwork-exempt: yes
---
swiper.el | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/swiper.el b/swiper.el
index 39f6bfc..d57d2bc 100644
--- a/swiper.el
+++ b/swiper.el
@@ -1536,10 +1536,19 @@ When not running `swiper-isearch' already, start it."
(setq thing (ivy-thing-at-point))))
(swiper-isearch thing))))
+(defun swiper-isearch-C-r (&optional arg)
+ "Move cursor vertically up ARG candidates.
+When the input is empty, browse the search history instead."
+ (interactive "p")
+ (if (string= ivy-text "")
+ (ivy-reverse-i-search)
+ (ivy-previous-line arg)))
+
(defvar swiper-isearch-map
(let ((map (make-sparse-keymap)))
(set-keymap-parent map swiper-map)
(define-key map (kbd "M-n") 'swiper-isearch-thing-at-point)
+ (define-key map (kbd "C-r") 'swiper-isearch-C-r)
map)
"Keymap for `swiper-isearch'.")