branch: externals/ivy-hydra commit ba4c1d53e542a32e0134db3cd94ea698e40c39c6 Author: Oleh Krehel <ohwoeo...@gmail.com> Commit: Oleh Krehel <ohwoeo...@gmail.com>
swiper.el (swiper-C-s): New command bound to "C-s" for swiper * ivy.el (ivy-minibuffer-map): Don't bind "C-s" by default. "C-s" doesn't make sense for ivy commands that aren't for search. Let's move "C-s" to a different map. Re #2447 --- ivy.el | 1 - swiper.el | 9 +++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ivy.el b/ivy.el index 4f7514c..029df86 100644 --- a/ivy.el +++ b/ivy.el @@ -418,7 +418,6 @@ action functions.") (define-key map (kbd "TAB") 'ivy-partial-or-done) (define-key map [remap next-line] 'ivy-next-line) (define-key map [remap previous-line] 'ivy-previous-line) - (define-key map (kbd "C-s") 'ivy-next-line-or-history) (define-key map (kbd "C-r") 'ivy-reverse-i-search) (define-key map (kbd "SPC") 'self-insert-command) (define-key map [remap delete-backward-char] 'ivy-backward-delete-char) diff --git a/swiper.el b/swiper.el index 22c1de4..7924c21 100644 --- a/swiper.el +++ b/swiper.el @@ -134,8 +134,17 @@ Treated as non-nil when searching backwards." :type 'boolean :group 'swiper) +(defun swiper-C-s (&optional arg) + "Move cursor vertically down ARG candidates. +If the input is empty, select the previous history element instead." + (interactive "p") + (if (string= ivy-text "") + (ivy-previous-history-element 1) + (ivy-next-line arg))) + (defvar swiper-map (let ((map (make-sparse-keymap))) + (define-key map (kbd "C-s") 'swiper-C-s) (define-key map (kbd "M-q") 'swiper-query-replace) (define-key map (kbd "C-l") 'swiper-recenter-top-bottom) (define-key map (kbd "C-'") 'swiper-avy)