Hate to ask this because I'm sure the answer is already out there somewhere, but I've searched help and vim.org until I was blue in the fingers.... I could swear that I remember from a few years back that there's a way to do this. Can't remember whether it required something special in the patterns or some special :set variable or loading a plugin.

I want to the replace pattern in a substitution to be able to figure out whether I want an upper or lower character in the replacement, depending on whether the search pattern matched an upper or lower character. Very useful for substitutions on studlyCaps.

For example, suppose I want to replace all instances of 'first' with 'last' and of 'First' with 'Last'. Can I do that with a slinge :s/// line?

Thanks-
Marshall

Reply via email to