How do I uppercase or lowercase the entire current line in one keystroke?
Answer
gUU
Explanation
The gUU command uppercases every character on the current line instantly — no visual selection or motion required. It follows the same doubling pattern as dd, yy, and cc: pressing the operator's motion key twice applies it to the whole line.
How it works
gUis the "make uppercase" operator- The second
Uacts as a shorthand for the current-line text object, applyinggUto the entire line
The same pattern gives you three case-change variants:
| Command | Effect |
|---|---|
gUU |
Uppercase the whole line |
guu |
Lowercase the whole line |
g~~ |
Toggle case of every character on the line |
Example
Given this line with the cursor anywhere on it:
hello world
Pressing gUU produces:
HELLO WORLD
Pressing guu on that result restores:
hello world
Tips
- Use
gU{motion}to uppercase a region, e.g.gUiwuppercases the word under the cursor guuis the counterpart togUU— both accept counts:2guulowercases two lines- The same doubling trick applies to
guandg~:guu,g~~all work without a separate motion