Skip to content

add option evil-ex-search-skip-matches-under-point #1131

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions evil-search.el
Original file line number Diff line number Diff line change
Expand Up @@ -981,6 +981,9 @@ any error conditions."
(with-current-buffer evil-ex-current-buffer
(with-selected-window (minibuffer-selected-window)
(goto-char (1+ evil-ex-search-start-point))
(when (and (eq evil-ex-search-direction 'forward)
(not evil-ex-search-skip-matches-under-point))
(forward-char -1))
(condition-case err
(let* ((result (evil-ex-search-full-pattern pattern-string
(or evil-ex-search-count 1)
Expand Down Expand Up @@ -1087,6 +1090,10 @@ current search result."
(signal (car err) (cdr err))))))
;; pattern entered successful
(goto-char (1+ evil-ex-search-start-point))
(when (and (eq evil-ex-search-direction 'forward)
(not evil-ex-search-skip-matches-under-point))
(forward-char -1))

(let* ((result
(evil-ex-search-full-pattern search-string
evil-ex-search-count
Expand Down
6 changes: 6 additions & 0 deletions evil-vars.el
Original file line number Diff line number Diff line change
Expand Up @@ -1109,6 +1109,12 @@ codes. Note that this only affects the search command if
always uses plain Emacs regular expressions."
:type 'boolean
:group 'evil)
(defcustom evil-ex-search-skip-matches-under-point t
"Whether skips matches that don't move the cursor.
Note that this only affects the search command
if `evil-search-module' is set to 'evil-search."
:type 'boolean
:group 'evil)

(defcustom evil-ex-interactive-search-highlight 'all-windows
"Determine in which windows the interactive highlighting should be shown."
Expand Down