Changing capitalisation of words
In Vim, while in normal mode, if you type ~
, the capitalisation of the
letter under the cursor changes and the cursor is advanced to the right.
You can also change the capitalisation of multiple letters at the same time
with g
command. Type gU
and a movement to make every letter corresponding
to the movement to become uppercase. gu
makes it lowercase and g~
toggles
the case. You can repeat the last character to affect the whole line (guu
,
gUU
, g~~
).
For example:
This is a test.
g~~
will change that line to “tHIS IS A TEST.”. gUU
will change
the whole line to uppercase: “THIS IS A TEST.”. guu
will change
it to lowecase: “this is a test”.
Photo by the author