In the replacement part of a substitution command, i.e. between
the second "/" and third "/",
|Vi ---> Switching cases|
\u means make the following character upper case
\l means make the following character lower case
\U means make the rest of the replacement upper case
\L means make the rest of the replacement lower case
How about a few examples?
- Make the first letter of every word from line 18 to 43 uppercase.
- Change "uPPeR" and "LoweR" in any mixture of cases to lowercase.
- Make the whole file uppercase.
- Make the region from line m to line n all uppercase.
- Make a paragraph all lowercase.
- Make the first letter of every word in a paragraph uppercase.
:?^$?,/^$/s/\([^ ][^ ]*\)/\u&/g
- Make the second word of each line uppercase.
:1,$s/^\([^ ]*\) \([^ ]*\) \(.*\)/\1 \U\2\e \3/
© 1993-1998 Christopher C. Taylor