How do I toggle the case of all characters in a visual selection?
Answer
~ (in visual mode)
Explanation
In visual mode, pressing ~ toggles the case of every character in the selection. Lowercase becomes uppercase and vice versa.
How it works
- Select text with any visual mode
- Press
~to toggle case - Each character flips individually
Example
Hello World
Select with V, press ~:
hELLO wORLD
Tips
Uconverts selection to uppercaseuconverts selection to lowercase~toggles each character individuallyg~{motion}toggles without visual mode- Works with all visual mode types including block