How to change to uppercase or lowercase in Vim
In Normal mode, gU makes text uppercase and gu lowercase, followed by how much: gUiw for the word under the cursor, gUU or guu for the whole line. ~ flips the case of the one letter under the cursor.

The style guide for the shop's ordering code says constants go in capitals, like TAX_RATE at the top of shop.js. The two below it were typed in lowercase. The letters are right, so there's no reason to type them again.
const open_hour = 11;const OPEN_HOUR = 11;Constants in capitals
Read gUiw as "uppercase inner word". The cursor is in open_hour.
This editor needs a keyboard. Read on, and play it at your computer.
Change the case of a whole line
gU and gu work like d and c. What comes after says how much, so gUw changes up to the next word and gU$ everything to the end of the line. Say the verb twice and it takes the whole line from anywhere on it. gUU puts the line in capitals and guu puts it in lowercase.
g~ flips the case of every letter it covers, capitals to small and small to capitals. That makes g~~ the fix for a line somebody typed with Caps Lock on, where the first letter came out small and everything after it came out big.
The specials board
One line on the board went up with Caps Lock on, and the last line should shout like the heading does. The cursor is on the Caps Lock line.
This editor needs a keyboard. Read on, and play it at your computer.
Capitalize one letter with ~
~ flips the case of the letter under the cursor and then moves one to the right, which makes it the quickest way to give a word its capital first letter. Press it again and it flips the next letter along. A count flips that many in a row, so 3~ does three. On a digit or a comma it changes nothing and still moves on.
Twice to be sure
You want the line to read Al pastor. The cursor is on the a, in Normal mode, and you press ~ twice to be sure. What does the line say now?
Change case in Visual mode
When it's easier to see what you're changing, select it first. v starts a selection that you stretch with any move, and V selects whole lines. Then U puts the selection in capitals and u puts it in lowercase. ~ flips it.
Ask about our salsa barASK ABOUT OUR SALSA BARCapitalize every word in a file
For a whole file, the substitute command can do it. In its replacement, \u makes the next character a capital and \U makes everything after it capitals. \<. matches the first character of each word and & stands for whatever matched, so :%s/\<./\u&/g gives every word on every line a capital first letter. Vim counts an underscore as part of a word, so max_rush becomes Max_rush.
Fillings for the board
The fillings came out of a spreadsheet in lowercase, and on the board each word gets a capital.
:%s/\<./\u&/g and press ↵fillings.txtThis editor needs a keyboard. Read on, and play it at your computer.
| Keys | Changes |
|---|---|
| gUiw / guiw | the word under the cursor, to capitals / to lowercase |
| g~iw | the word, every letter flipped |
| gUU / guu / g~~ | the whole line (gUgU, gugu and g~g~ work too) |
| 3gUU | three lines, starting with this one |
| gUw / gU$ | up to the next word / to the end of the line |
| ~ / 3~ | one letter / three letters, moving right as it goes |
| U / u / ~ in Visual mode | the selection, to capitals / to lowercase / flipped |
| gg then gUG | the whole file to capitals (gg then guG for lowercase) |
:%s/\<./\u&/g | a capital at the start of every word in the file |
:%s/.*/\U&/ | every line in capitals |
:s/.*/\L\u&/ | the line in lowercase with a capital first letter |