Search code examples
vim

Changing case in Vim


Is there a command in Vim that changes the case of the selected text?


Solution

  • Visual select the text, then U for uppercase or u for lowercase. To swap all casing in a visual selection, press ~ (tilde).

    Without using a visual selection, gU<motion> will make the characters in motion uppercase, or use gu<motion> for lowercase.

    For more of these, see Section 3 in Vim's change.txt help file.