Converting case of characters to upper or lower case can be easily done in vim by using the following key combinations in normal mode.
Toggle case of character under cursor - ~
Toggle case of n characters from current char - n~
Toggle case of n words from current char - g~nw
Toggle case of current word(cursor anywhere in word)- g~iw
Toggle case of all characters till end of line - g~$
Toggle case of all characters in current line - g~~
To convert only to upper case one can substitute ~ with U in the above commands starting with g(commands 3-6).
Similarly to convert only to lower case one can substitute ~ with u in the above commands starting with g(commands 3-6).
Note:
If you use U without the g char as in first two key combinations listed above,
vimwill undo all change to the current line. Similarly for u will undo the last change made to file instead of lower casing the char.
References: