How to detect Caps lock in Vimrc function

When editing code in Vim, I often use caps lock when writing files to ALL CAPS. However, I often forget to disable the cap lock when I finished with the title part. This does not hurt (as j moves down, but J joins the current line with a line below).

Usually, when I exit insert mode, I want to disable the lock. How can I add something to my .vimrc so that it can disable the header lock when exiting insert mode? Alternatively, how can I add something to my .vimrc so that it alerts me (status bar? Beep? Any warning is ok) if I have a lock lock when I exit insert mode?

Thanks!

+7
source share
1 answer

Like all other applications, Vim / GVIM sits on top of the abstractions of the terminal / window manager and therefore does not have direct access to the basic functions of the raw keyboard. Therefore, obtaining Caps Lock information will include messy and platform hacks.

Instead, I would suggest using Vim features to β€œemulate” Caps Lock in Vim, since you don't have the problems you mentioned. Look at the Caps Lock Insertion Only article, which explains this in detail.

+4
source

All Articles