branch: master
commit a2ed614d4c1675bcdafdab238f2d5a84f49fc32f
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>

    ivy.el (ivy-occur-mode-map): Make "RET" switch window
    
    * ivy.el (ivy-occur-press-and-switch): New command.
---
 ivy.el | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/ivy.el b/ivy.el
index 05b34f7..3c9d551 100644
--- a/ivy.el
+++ b/ivy.el
@@ -3183,7 +3183,7 @@ buffer would modify `ivy-last'.")
 (defvar ivy-occur-mode-map
   (let ((map (make-sparse-keymap)))
     (define-key map [mouse-1] 'ivy-occur-click)
-    (define-key map (kbd "RET") 'ivy-occur-press)
+    (define-key map (kbd "RET") 'ivy-occur-press-and-switch)
     (define-key map (kbd "j") 'ivy-occur-next-line)
     (define-key map (kbd "k") 'ivy-occur-previous-line)
     (define-key map (kbd "h") 'backward-char)
@@ -3409,6 +3409,11 @@ EVENT gives the mouse position."
                 (cancel-timer ivy-occur-timer))
               (setq ivy-occur-timer (run-at-time 1.0 nil 
'swiper--cleanup))))))))
 
+(defun ivy-occur-press-and-switch ()
+  (interactive)
+  (ivy-occur-press)
+  (select-window (ivy--get-window ivy-last)))
+
 (defvar ivy-help-file (let ((default-directory
                              (if load-file-name
                                  (file-name-directory load-file-name)

Reply via email to