Sei sulla pagina 1di 3

Vim - Convert text to lowercase or uppercase (... https://coderwall.com/p/anvddw/vim-convert-tex...

Coderwall Sign In or Up

Last Updated: February 25, 2017 ·  12.1K · nicolaslazartekaqui

Vim - Convert text to lowercase or


uppercase
VIM

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)

1 of 3 4/12/18, 8:18 AM
Vim - Convert text to lowercase or uppercase (... https://coderwall.com/p/anvddw/vim-convert-tex...

:%s/[A-Z]/\U&/g

Or if you want use this function in character, you can switch case doing
this in character

Written by Nícolas Lazarte Kaqui

 Recommend  Say Thanks  Update Notifications Off

 Respond

1 Response

dpadilla
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 · 

 Filed Under

Tools

 Sponsors

2 of 3 4/12/18, 8:18 AM
Vim - Convert text to lowercase or uppercase (... https://coderwall.com/p/anvddw/vim-convert-tex...

 Awesome Job See All Jobs 

Software Engineering Team Lead (Ruby on Rails)


Customer Lobby · Berkeley, CA · Full Time

Post a job for only $299

@coderwall    Contact Privacy Terms Copyright 2018

3 of 3 4/12/18, 8:18 AM

Potrebbero piacerti anche