On , I learnt ...

That Vim can transform replacement values when substituting

Vim supports a range of special patterns that can transform the replacement value when performing a search and replace.

For example, inserting \U will make all following characters upper case (until the pattern ends of \E is encountered). So running:

:%s/name = "\(.*\)"/upper_case_name = "\U\1"/g


name = "Alan"
name = "Barry"
name = "Callum"

will result in:

upper_case_name = "ALAN"
upper_case_name = "BARRY"
upper_case_name = "CALLUM"

Some useful transformations to be aware of:

See :help sub-replace-special for more.