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
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