Vim - Convert text to lowercase or uppercase
To convert all text to lowercase in vim do
ggVGu
or uppercase
ggVGU
look at the command ggVG
is used to select all the text if you want you can select the text and use U
or u
to convert what was selected to uppercase or lowercase.
If you want use this function in search/replace, do this to lowercase (example)
:%s/[A-Z]/\L&/g
or to uppercase (example)
:%s/[A-Z]/\U&/g
Or if you want use this function in character, you can switch case doing this in character
~
Related protips:
Written by Nícolas Lazarte Kaqui
Related protips
1 Response
Thanks for the information!
One small correction, to change to uppercase needs to find lowercase characters:
:%s/[a-z]/\U&/g
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Vim
Authors
Related Tags
#vim
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#