How To Switch to Lower or Upper Case in Vi or Vim

for uppercase: gggUG
for lowercase: ggguG

PS: the first 2 g’s are for moving to the beginning of the document.
PS2: works in vim, don’t know about plain vi

Can also do this using the search function in command mode

<esc> :%s/.*/\L&/

and in uppercase :

<esc> :%s/.*/\U&/

Leave a Reply

Your email address will not be published. Required fields are marked *