greduan
greduan

Reputation: 4938

VimL: How to find out if I have CAPS lock on/off

Right now I'm creating a plugin of sorts for Vim, it's meant to simply have all kinds of utility functions to put in your statusline, here's the link: https://github.com/Greduan/vim-usefulstatusline

So here's my question, my next addition is meant to be a little output that tells you whether you have CAPS lock on or off, it would output [CAPSLOCK] if it's turned on, and nothing if it's turned off.

Any help is greatly appreciated. :)

Upvotes: 0

Views: 242

Answers (1)

ZyX
ZyX

Reputation: 53654

There is no way you can query this independent of the system, at least with not any default vim plugin or python module (don’t know about other interpreters). You can use just the same hack as suggested here for linux

echo and(system('xset q | grep LED')[65], 1)

I never saw people actually wanting caps lock in vim anyway.

Upvotes: 3

Related Questions