Vim Tips Wiki
Advertisement

Previous TipNext Tip

Tip: #49 - Switching case of characters

Created: March 14, 2001 9:24 Complexity: basic Author: Anonymous Version: 5.7 Karma: 102/51 Imported from: Tip#49

You can change the case of letters:

Toggle case "HellO" to "hELLo" with ~.
Uppercase "HellO" to "HELLO" with gU.
Lowercase "HellO" to "hello" with gu.

Examples

~
Toggle case of the character under the cursor, or all visually-selected characters.
3~
Toggle case of the next three characters.
g~~
Toggle case of the current line.
U
Uppercase the visually-selected text.
First press v or V then move to select text.
If you don't select text, pressing U will undo all changes to the current line.
gUU
Change the current line to uppercase.
u
Lowercase the visually-selected text.
If you don't select text, pressing u will undo the last change.
guu
Change the current line to lowercase.
gUaw
Change current word to uppercase.
guaw
Change current word to lowercase.

References

:help case

Comments

Advertisement