Fast way to type or change to AlTeRnAtInG CaPs?
Substitution is one way...
\v: use "very magic" mode
(.): first dot is our "odd" character; enclosed in capture group 1
(.?): second dot is our "even" character; enclosed in capture group 2; have to make it optional in order to capitalize last char of line if it's "odd"
\u: convert to uppercase the character that follows which is...
\1: ...the "odd" character
\l: convert to lowercase the character that follows which is...
\2: ...the "even" character
g: ensure that this is repeated for every pair of characters on the line.
You could use a macro, started on the first letter of the word (and assuming
it's all lower cast to begin with (if not do
guu to put the line into lower
Then just do
@a to replay the macro (and thereafter
@@ to repeat). This
won't ensure that the first letter of each word in a sentence is of the same
SoMe aLtErNaTiNg tExT
If you need to exchange upper and lower case in some non-alternating pattern, i.e change this:
SoMe wEIRd capiTaliSation Going on herE
sOmE WeirD CAPItALIsATION gOING ON HERe
you can do
g~~ (thanks to @Rich for the tip)