Is there a built-in way in Vim to search for a pattern in a case-insensitive way, and substituting the occurrence conserving its case? (Something like an s/abcd/efgh that matches AbCd and replaces it with EfGh.)

1 Answer 1


There are ways to match characters case-sensitively, and replacement special forms that uppercase or lowercase their arguments, but there is not a native way to do that.

However, tpope has the excellent vim-abolish which provides a command :Subvert that can accomplish this

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.