branch: master
commit 32025e51f86cb6dde03088e0bfea18d87f1f2cff
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>
Add a better ivy-occur pulse to swiper and counsel-git-grep
* ivy.el (ivy-occur-press): Bind `ivy-exit' to 'done, so that
`swiper--add-overlays' called by ACTION don't do anything.
Call another `swiper--add-overlays' for swiper and counsel-git-grep,
limited to the current line. Call `swiper--cleanup' with a delay of 1
second.
---
ivy.el | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/ivy.el b/ivy.el
index b7a238a..5aa109d 100644
--- a/ivy.el
+++ b/ivy.el
@@ -2148,14 +2148,24 @@ EVENT gives the mouse position."
(+ 4 (line-beginning-position))
(line-end-position)))
(coll (ivy-state-collection ivy-last))
- (action ivy-occur-action))
+ (action ivy-occur-action)
+ (ivy-exit 'done))
(with-ivy-window
(funcall action
(if (and (consp coll)
(consp (car coll)))
(cdr (assoc str coll))
str))
- (pulse-momentary-highlight-one-line (point)))))
+ (if (memq (ivy-state-caller ivy-last)
+ '(swiper counsel-git-grep))
+ (with-current-buffer (window-buffer (selected-window))
+ (swiper--add-overlays
+ (ivy--regex ivy-text)
+ (line-beginning-position)
+ (line-end-position)
+ (selected-window))
+ (run-at-time 1 nil 'swiper--cleanup))
+ (pulse-momentary-highlight-one-line (point))))))
(defun ivy-insert-current ()
"Make the current candidate into current input.