tags:

views:

126

answers:

2

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

+19  A: 

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

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.

Mark Rushakoff
up up-vote and away. +1 for you sir.
jeffjose
+1  A: 

See the following methods

~ :changes the lower case to upper case of current character

~guu :change current line from upper to lower.

~gUU :Change current LINE from lower to upper.

~guw :Change current WORD from upper to lower.

~gUw :Change current WORD from lower to upper.

g~~ :Invert case to entire line

Refer the link: http://stackoverflow.com/questions/2573/vim-tutorials/2650815#2650815

ungalnanban