;; Author: Oleh Krehel <ohwoeowho@gmail.com>
;; URL: https://github.com/abo-abo/swiper
-;; Version: 0.4.0
+;; Version: 0.4.1
;; Package-Requires: ((emacs "24.1"))
;; Keywords: matching
map)
"Keymap for swiper.")
+(defvar swiper--window nil
+ "Store the current window.")
+
(defun swiper-query-replace ()
"Start `query-replace' with string to replace from last search string."
(interactive)
(from (ivy--regex ivy-text))
(to (query-replace-read-to from "Query replace" t)))
(delete-minibuffer-contents)
- (ivy-set-action (lambda ()
+ (ivy-set-action (lambda (_)
(with-selected-window swiper--window
(perform-replace from to
t t nil))))
(defun swiper-avy ()
"Jump to one of the current swiper candidates."
(interactive)
- (with-selected-window (ivy-state-window ivy-last)
- (let* ((candidates
- (avy--regex-candidates
- (ivy--regex ivy-text)))
- (avy-background nil)
- (candidate
- (avy--process candidates #'avy--overlay-post)))
- (ivy-quit-and-run
- (avy--goto candidate)))))
-
-(defvar swiper--window nil
- "Store the current window.")
+ (unless (string= ivy-text "")
+ (with-selected-window (ivy-state-window ivy-last)
+ (let* ((avy-all-windows nil)
+ (candidates
+ (avy--regex-candidates
+ (ivy--regex ivy-text)))
+ (avy-background nil)
+ (candidate
+ (avy--process candidates #'avy--overlay-post)))
+ (ivy-quit-and-run
+ (avy--goto candidate))))))
(defun swiper-recenter-top-bottom (&optional arg)
"Call (`recenter-top-bottom' ARG) in `swiper--window'."
org-agenda-mode
dired-mode
jabber-chat-mode
- elfeed-search-mode)))
+ elfeed-search-mode
+ fundamental-mode)))
(unless (> (buffer-size) 100000)
(if (fboundp 'font-lock-ensure)
(font-lock-ensure)
"")
((equal str "^")
".")
- ((string-match "\\^" str)
+ ((string-match "^\\^" str)
(setq ivy--old-re "")
(let ((re (ivy--regex-plus (substring str 1))))
(format "^[0-9][0-9 ]\\{%d\\}%s"