diff options
| author | Evgeni Kolev <evgenysw@gmail.com> | 2017-04-10 18:33:38 +0300 |
|---|---|---|
| committer | Evgeni Kolev <evgenysw@gmail.com> | 2017-04-17 16:05:15 +0300 |
| commit | b3e6f7d75774cfbfa437ea5f89cbed1496e34209 (patch) | |
| tree | bee72ea91e971b4bd55b52397beeb6ed406b520e /evil-search.el | |
| parent | 273a714e2d073257f6604d03be53c5fd784117c4 (diff) | |
:global should use last pattern if none given
Diffstat (limited to 'evil-search.el')
| -rw-r--r-- | evil-search.el | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/evil-search.el b/evil-search.el index db5c604..0a52114 100644 --- a/evil-search.el +++ b/evil-search.el @@ -1204,7 +1204,19 @@ This handler highlights the pattern of the current substitution." (defun evil-ex-parse-global (string) "Parse STRING as a global argument." - (evil-delimited-arguments string 2)) + (let* ((args (evil-delimited-arguments string 2)) + (pattern (nth 0 args)) + (command (nth 1 args))) + ;; use last pattern if none given + (when (zerop (length pattern)) + (setq pattern + (cond + ((and (eq evil-search-module 'evil-search) evil-ex-search-pattern) + (evil-ex-pattern-regex evil-ex-search-pattern)) + ((and (eq evil-search-module 'isearch) (not (zerop (length isearch-string)))) + isearch-string) + (t (user-error "No previous pattern"))))) + (list pattern command))) (defun evil-ex-get-substitute-info (string &optional implicit-r) "Returns the substitution info of command line STRING. |
