I want to upper case words in vi (this is a verilog syntax file where I want to change the connectivity).
For example:
.STRING0(string1) .String2(string3)
,
I want to upper case one whole string and just first letter of second string something like
.STRING0(STRING1) .String2(String3),
My search pattern is:
%s/\.\(.*\)(\(.*\)) \.\(.*\)(\(.*\))/
and I need a replace pattern like
.\1(\2) .\3(\4)/
where buffer \2
is completely upper-cased and contents of buffer \4
is titled-cased. How is this possible?
Use the
\U
and\u
substitution modifiers:From the Vim help:
Note that the above substitution will use title case for the
\4
match as long as it only contains one word, i.e., the substitution only converts the first character in the\4
match.