Last Updated: February 25, 2016
·
308
· iamjarvo

Switching case in vim

Have you experienced the pain of holding the shift button for too long while coding ? You end up with something like this findByusername. In vim you can convert the word to a specific case or toggle the case.

# select the word
viw

# convert all letters to lowercase 
gu #=> find_by_username

# convert all letters to uppercase
gU #=> FIND_BY_USERNAME

# toggle case
g~ #=> FIND_bY_USERNAME