How do I make %s/x/y/gc use case insensitive matching but do case sensitive replaces?

In emacs terms, I want case-fold-search but not case-replace.

1 Answer 1


Looking at the code of evil-ex-substitute (using C-h f), the value for case-replace is set to the value of case-fold-search in the let* form.

So it looks like there is no configuration option provided for this by default. But of course you can just replace the case-fold-search with (not case-fold-search) after the case-replace in that let* and (re)evaluate the evil-ex-substitute function definition.

NOTE how the value of case-fold-search is set via evil-ex-pattern-ignore-case. This a.o. means that you can use vim style patterns to set the value for case-fold-search (using \c/\C as explained e.g. in this SE-answer).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.