Skip to content
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

Ex-substitute: use last search's case-sensitivity #1906

Merged
Merged
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
3 changes: 3 additions & 0 deletions evil-search.el
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions evil-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down