Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Toggle the case of the character under cursor in vim

Tags:

vim

When adding a prefix to a camel case variable, I usually need to Capitalize the (now second) word of the identifier. For example, when logGroup becomes localLogGroup, log becomes Log.

I am looking for a way to toggle the case of the current character (the one highlighted by the cursor) in vim.

The point is toggling the case without selecting the character - same way as x deletes it. I simply want to toggle its case.

Any idea how to achieve this?

like image 563
Adam Matan Avatar asked Jul 17 '17 08:07

Adam Matan


1 Answers

For changing case of character under cursor, you can use ~. More at :help ~.

~ can also be made as a operator when top is set. More at :help top.

like image 158
dlmeetei Avatar answered Oct 10 '22 12:10

dlmeetei