branch: externals/ivy
commit fb59dc2c6296a3a58164536380124f70fa2c5591
Author: Basil L. Contovounesios <[email protected]>
Commit: Basil L. Contovounesios <[email protected]>

    Simplify ivy-avy and swiper-avy key bindings
    
    Both counsel-ag and counsel-grep seem to work with the default C-'
    binding of ivy-avy in ivy-minibuffer-map, so overriding it with
    swiper-avy may be unnecessary (#1711).
    
    Meanwhile swiper works only with swiper-avy and not ivy-avy, so
    remap the latter to the former in swiper-map.  This means users who
    change the C-' binding in ivy-minibuffer-map will not have to also
    repeat the same in swiper-map (#1711, #3074).  Keep C-' override for
    backward compatibility.
    
    * counsel.el (counsel-ag-map, counsel-grep-map): Remove swiper-avy
    key binding.  Add docstring.
    * swiper.el (swiper-map): Remap ivy-avy to swiper-avy.
---
 counsel.el | 8 ++++----
 swiper.el  | 1 +
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/counsel.el b/counsel.el
index 67d0b49412..8d66985c9b 100644
--- a/counsel.el
+++ b/counsel.el
@@ -3152,9 +3152,9 @@ INITIAL-DIRECTORY, if non-nil, is used as the root 
directory for search."
   (let ((map (make-sparse-keymap)))
     (define-key map (kbd "C-l") #'ivy-call-and-recenter)
     (define-key map (kbd "M-q") #'counsel-git-grep-query-replace)
-    (define-key map (kbd "C-'") #'swiper-avy)
     (define-key map (kbd "C-x C-d") #'counsel-cd)
-    map))
+    map)
+  "Keymap for `counsel-ag'.")
 
 (defcustom counsel-ag-base-command (list "ag" "--vimgrep" "%s")
   "Template for default `counsel-ag' command.
@@ -3495,8 +3495,8 @@ Example input with inclusion and exclusion file patterns:
   (let ((map (make-sparse-keymap)))
     (define-key map (kbd "C-l") #'ivy-call-and-recenter)
     (define-key map (kbd "M-q") #'swiper-query-replace)
-    (define-key map (kbd "C-'") #'swiper-avy)
-    map))
+    map)
+  "Keymap for `counsel-grep'.")
 
 (defcustom counsel-grep-base-command "grep -E -n -e %s %s"
   "Format string used by `counsel-grep' to build a shell command.
diff --git a/swiper.el b/swiper.el
index e66be4db26..c39423a783 100644
--- a/swiper.el
+++ b/swiper.el
@@ -160,6 +160,7 @@ If the input is empty, select the previous history element 
instead."
     (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)
+    (define-key map [remap ivy-avy] #'swiper-avy)
     (define-key map (kbd "C-7") #'swiper-mc)
     (define-key map (kbd "C-c C-f") #'swiper-toggle-face-matching)
     map)

Reply via email to