diff --git a/evil-search.el b/evil-search.el index 9f283a29..e47a84ee 100644 --- a/evil-search.el +++ b/evil-search.el @@ -1200,6 +1200,9 @@ is used. It is meant for :substitute commands with arguments." isearch-string (concat isearch-string "\\C"))) flags (remq ?r flags))) + (when (and using-prev-pattern + (not (evil-ex-pattern-ignore-case evil-ex-search-pattern))) + (setq pattern (concat pattern "\\C"))) ;; generate pattern (when pattern ;; Disable vim-style regexp conversion if using a previous pattern, because diff --git a/evil-tests.el b/evil-tests.el index 39f3c309..724ea9b9 100644 --- a/evil-tests.el +++ b/evil-tests.el @@ -8206,6 +8206,14 @@ golf h[o]>tel"))) "[x]xx AAA bar AAA bar AAA bar\nxxx foo bar foo bar foo bar" ("g&") "xxx AAA bar AAA bar AAA bar\n[x]xx AAA bar AAA bar AAA bar")) + (ert-info ("Substitute with last search, maintaining case sensitivty") + (evil-select-search-module 'evil-search-module 'evil-search) + (evil-test-buffer + "[a]lpha\nbravo\nbravo\ncharlie\nBravo\ndelta" + ("/\\Cbravo" [return]) + "alpha\n[b]ravo\nbravo\ncharlie\nBravo\ndelta" + (":%s//zulu" [return]) + "alpha\nzulu\n[z]ulu\ncharlie\nBravo\ndelta")) (ert-info ("Repeat magic multiple times") (let ((evil-magic 'very-magic) (evil-ex-search-vim-style-regexp t))