aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Dalziel <tom_dl@hotmail.com>2022-04-15 15:56:44 +0100
committerTom Dalziel <33435574+tomdl89@users.noreply.github.com>2022-04-15 17:16:09 +0200
commitfd0644ebfc7e827ea790a7b8fb6c590aada6b225 (patch)
treed3a835fc76dd243ea7e3c466d4bdb0cd96f39108
parent41006dc73d8c850d2a6378a3c026aedb16b80813 (diff)
Allow vim-style regexp for :global command
-rw-r--r--evil-commands.el2
-rw-r--r--evil-tests.el8
2 files changed, 9 insertions, 1 deletions
diff --git a/evil-commands.el b/evil-commands.el
index ad57b22..94b1ba7 100644
--- a/evil-commands.el
+++ b/evil-commands.el
@@ -3992,6 +3992,8 @@ This is the same as :%s//~/&"
(deactivate-mark deactivate-mark)
match markers)
(when (and pattern command)
+ (when evil-ex-search-vim-style-regexp
+ (setq pattern (evil-transform-vim-style-regexp pattern)))
(setq isearch-string pattern)
(isearch-update-ring pattern t)
(goto-char beg)
diff --git a/evil-tests.el b/evil-tests.el
index 028a105..65fd8f4 100644
--- a/evil-tests.el
+++ b/evil-tests.el
@@ -8269,7 +8269,13 @@ maybe we need one line more with some text\n")
(evil-test-buffer
"this\nThis\n"
(":g/This/d" [return])
- "this\n")))))
+ "this\n"))))
+ (ert-info (":global should transform vim-style regexp when appropriate")
+ (let ((evil-ex-search-vim-style-regexp t))
+ (evil-test-buffer
+ "a\n1\nb\n2\nc\n3\n"
+ (":g/\\d/>")
+ "a\n 1\nb\n 2\nc\n 3\n"))))
(ert-deftest evil-test-normal ()
"Test `evil-ex-normal'."