Vim: gU and gu on the same map

in vim, with

gUw

enter uppercase,

gUw

enter a lowercase word. How can I convert one card from top to bottom and bottom to top?

+5
source share
2 answers

If you are trying to invert case, you can use ~. Usually this only works when you select (for example, in visual mode), but if you want it to be more useful, then :set tildeopyou can do ~wor whatever move command you like.

+7
source

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

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

+4
source

All Articles