47657RE: Preserve case during search & replace?
- Feb 10, 2004Look no further (and of course it has been done) :-)
Michael Geddes wrote KeepCase.vim
It is a script (not a plugin), so open it, type
Then try one of his examples, works great for me.
> -----Original Message-----
> From: Paul Brinkley [mailto:laugh@...]
> Sent: Tuesday, February 10, 2004 12:44 PM
> To: vim@...
> Subject: Preserve case during search & replace?
> [I searched all over the web for an answer to this problem,
> including vim.org's Tips, Sourceforge, Google, and Google
> Groups. I found one reference to it in comp.editors back in
> 2001, unsolved. The thread title is "case-preserving replace
> in vi[m]?".]
> Basically, I'd like to replace (e.g.) "apple" with "banana"
> everywhere in a block of text, but if "apple" happens to be
> capitalized, it should be replaced with "Banana". In other
> words, I'd like a handy way of doing
> (assuming noignorecase) with one command.
> I could probably slog my way through a script to do this, but
> it strikes me as a fairly useful feature - would Vim be
> likely to have this feature added since 2001?
- << Previous post in topic Next post in topic >>