aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfermata101 <67665648+fermata101@users.noreply.github.com>2021-10-09 16:25:44 -0700
committerTom Dalziel <33435574+tomdl89@users.noreply.github.com>2022-04-12 22:47:04 +0200
commitbe009a9eaa101bba4a964c3e55de9849d6b473e2 (patch)
tree3ba0a985547a6bbf439f1f66875b417c43a26d66
parentec2c47a83df53993c53b1cf5598a13d41bd4c6b7 (diff)
Add option for non-incremental search (#1304)
-rw-r--r--doc/source/settings.rst2
-rw-r--r--evil-search.el7
-rw-r--r--evil-vars.el6
3 files changed, 13 insertions, 2 deletions
diff --git a/doc/source/settings.rst b/doc/source/settings.rst
index a855040..125d7d6 100644
--- a/doc/source/settings.rst
+++ b/doc/source/settings.rst
@@ -81,6 +81,8 @@ Search
.. elisp:autovariable:: evil-ex-hl-update-delay
+.. elisp:autovariable:: evil-ex-search-incremental
+
Indentation
-----------
diff --git a/evil-search.el b/evil-search.el
index d87acad..4df38b7 100644
--- a/evil-search.el
+++ b/evil-search.el
@@ -895,7 +895,8 @@ message to be shown. This function does nothing if
(defun evil-ex-search-start-session ()
"Initialize Ex for interactive search."
(remove-hook 'minibuffer-setup-hook #'evil-ex-search-start-session)
- (add-hook 'after-change-functions #'evil-ex-search-update-pattern nil t)
+ (when evil-ex-search-incremental
+ (add-hook 'after-change-functions #'evil-ex-search-update-pattern nil t))
(add-hook 'minibuffer-exit-hook #'evil-ex-search-stop-session)
(add-hook 'mouse-leave-buffer-hook #'evil-ex-search-exit)
(evil-ex-search-activate-highlight nil))
@@ -1140,7 +1141,9 @@ current search result."
evil-ex-search-match-end (match-end 0))
(evil-ex-search-goto-offset offset)
(evil-push-search-history search-string (eq direction 'forward))
- (unless evil-ex-search-persistent-highlight
+ (when (and (not evil-ex-search-incremental) evil-ex-search-highlight-all)
+ (evil-ex-search-activate-highlight pattern))
+ (when (and evil-ex-search-incremental (not evil-ex-search-persistent-highlight))
(evil-ex-delete-hl 'evil-ex-search)))
(t
(goto-char evil-ex-search-start-point)
diff --git a/evil-vars.el b/evil-vars.el
index 72003ec..989db57 100644
--- a/evil-vars.el
+++ b/evil-vars.el
@@ -1249,6 +1249,12 @@ used."
:type 'boolean
:group 'evil)
+(defcustom evil-ex-search-incremental t
+ "If t, use incremental search. Note that this only affects the
+search command if `evil-search-module' is set to 'evil-search."
+ :type 'boolean
+ :group 'evil)
+
(defcustom evil-ex-search-highlight-all t
"If t and interactive search is enabled, all matches are
highlighted."