Learn Vim / How to Change Case in Vim (Uppercase / Lowercase)

How to Change Case in Vim (Uppercase / Lowercase)

The answerPress ~ to toggle the case of the character under the cursor. For bigger targets: gUiw uppercases the word, guiw lowercases it.

All the ways

KeysWhat it does
~toggle case of one character
gUiwUPPERCASE the word under the cursor
guiwlowercase the word
gUUUPPERCASE the whole line
Vu / VUlowercase / uppercase the visual selection
▶ live vim buffertarget 2 keystrokes
“biat” should be “boat”. You're on the wrong letter — press r then o to replace it without entering insert mode.

Reading about keystrokes doesn't build keystrokes. Try this in a real vim buffer right now — the “One-letter fix” mission takes about a minute.

Sign in free to practice →

Keep going