branch: elpa/evil commit 691d0cd36e6c09ecbc18537b7721dcb6d775e873 Author: Tom Dalziel <tom...@hotmail.com> Commit: Tom Dalziel <33435574+tomd...@users.noreply.github.com>
Store :/ search pattern and parse vim-style regexp Fixes #1520 --- evil-ex.el | 19 +++++++++++-------- evil-search.el | 2 +- evil-vars.el | 2 +- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/evil-ex.el b/evil-ex.el index 1cd65ff404..a445e710c9 100644 --- a/evil-ex.el +++ b/evil-ex.el @@ -100,6 +100,7 @@ (+ signed-number #'+)) (marker ("'" marker-name #'(evil-ex-marker $2))) + ;; TODO - handle offset & ;next-pattern search elements (search forward backward @@ -107,15 +108,9 @@ prev subst) (forward - ("/" "\\(?:[\\].\\|[^/,; ]\\)+" (! "/") - #'(evil-ex-re-fwd $2)) - ("/" "\\(?:[\\].\\|[^/]\\)+" "/" - #'(evil-ex-re-fwd $2))) + ("/" "\\(?:[\\].\\|[^/]\\)+" "/\\|$" #'(evil-ex-re-fwd $2))) (backward - ("\\?" "\\(?:[\\].\\|[^?,; ]\\)+" (! "\\?") - #'(evil-ex-re-bwd $2)) - ("\\?" "\\(?:[\\].\\|[^?]\\)+" "\\?" - #'(evil-ex-re-bwd $2))) + ("\\?" "\\(?:[\\].\\|[^?]\\)+" "\\?\\|$" #'(evil-ex-re-bwd $2))) (marker-name "[]\\[-a-zA-Z_<>'}{)(]") (next @@ -824,6 +819,10 @@ Signal an error if MARKER is in a different buffer." (defun evil-ex-re-fwd (pattern) "Search forward for PATTERN. Returns the line number of the match." + (when evil-ex-search-vim-style-regexp + (setq pattern (evil-transform-vim-style-regexp pattern))) + (setq evil-ex-search-pattern (evil-ex-make-search-pattern pattern) + evil-ex-search-direction 'forward) (condition-case err (save-match-data (save-excursion @@ -841,6 +840,10 @@ Returns the line number of the match." (defun evil-ex-re-bwd (pattern) "Search backward for PATTERN. Returns the line number of the match." + (when evil-ex-search-vim-style-regexp + (setq pattern (evil-transform-vim-style-regexp pattern))) + (setq evil-ex-search-pattern (evil-ex-make-search-pattern pattern) + evil-ex-search-direction 'backward) (condition-case err (save-match-data (save-excursion diff --git a/evil-search.el b/evil-search.el index 0cc9c1b2ba..b57ad7bb43 100644 --- a/evil-search.el +++ b/evil-search.el @@ -939,7 +939,7 @@ Returns a triple (regexp offset next-search)." (defun evil-ex-search-full-pattern (pattern-string count direction) "Search for a full search pattern PATTERN-STRING in DIRECTION. -This function split PATTERN-STRING in +This function splits PATTERN-STRING into pattern/offset/;next-pattern parts and performs the search in DIRECTION which must be either 'forward or 'backward. The first search is repeated COUNT times. If the pattern part of diff --git a/evil-vars.el b/evil-vars.el index b01ee0aa6a..c99bf856ff 100644 --- a/evil-vars.el +++ b/evil-vars.el @@ -1939,7 +1939,7 @@ See `evil-ex-init-shell-argument-completion'.") "The direction of the current search, either 'forward or 'backward.") (defvar evil-ex-search-count nil - "The count if the current search.") + "The count of the current search.") (defvar evil-ex-search-start-point nil "The point where the search started.")