I want to replace all these at once:

Heading Name --> Another New Title
headingName  --> anotherNewTitle

I tried this:

:%S/heading{, }Name/another{, }New{, }Title/g

It replaces correctly including the first {, } brace pair on the replacement side, but the second one is substituted directly:

Heading Name --> Another New{, }Title
headingName  --> anotherNew{, }Title

Is there a way I can replace a space-separated string with a space separated string, while also replacing the camel cased version with its camel cased version?

I just found out I can use 'coercion' on a camel-cased word to turn it into a title-cased word, crt on anotherNewTitle would become Another New Title, but I would like a solution that uses only one substitution.


I have not found a way to use another {} in the replacement portion of :Subvert

You can however accomplish this replacement:

:%S/heading{Name, Name}/another{TitleNew, Title New}/

It just isn't very satisfying and does not really save you much work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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