Gilad Naor

Recent

Children - Science Education
Seattle and Trust
Moving to Seattle
Startup Investing for Everyone

Kill the CAPS LOCK!

The Caps Lock key can do wonders to wreak havoc in VI. You’re in command mode, minding your own business, when all of a sudden all hell breaks loose. All because you pressed the caps lock key instead of the shift key.

For a long while I was reluctant to follow the plethora of tutorials on how to kill the caps lock key. The reason is that there are several cases where I thought it was very beneficial to actually use it to, well, lock the caps. For example, by tradition, definitions in C/C++ are written in all capital letters. I finally figured out how to get along without the evil key, as I will explain below:

g~w - capitalize one word  
g~~ - capitalize the entire sentence  
gU{motion} - capitalize motion

I still have some open issues. For example, to capitalize the word I just wrote, I have to go backwards (‘b’) and then capitalize it (‘g~w’) and then go back to insert mode (‘A’). I’ll be happy to learn of better options, options that take into account that I despite having to configure my setup. Nonetheless, I’m now much better off than I was with the occasional caps lock accident.

You can now make the caps lock key do something else, such as behave as a shift key or an esc key.

Further Reading: