Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vim: gU and gu in one map

in vim, with

gUw

make the word uppercase, with

guw

make the word lowercase.
how I can convert in one map the upper to lower and the lower to upper?

like image 315
JuanPablo Avatar asked May 02 '12 19:05

JuanPablo


2 Answers

If you're trying to invert case, you can use ~. Normally this works only on the selection (e.g. visual mode), but if you want it to be more useful, then :set tildeop so you can do ~w or whatever movement command you like.

like image 69
Brian Avatar answered Nov 02 '22 14:11

Brian


You can use the tilde operator with global commands too: g~w

The advantage being, that you can then use the . operator to repeat the operation :)

like image 29
dsummersl Avatar answered Nov 02 '22 14:11

dsummersl