On 06/07/11 16:01, Михаил Голубев wrote:
Hello to everyone.

I want to write small function for my 'statusline' option, so it shows
whether Caps Lock button was pressed or not. I work on laptop and
"analog" led indicator is right under my wrist so I don't see it at all.
Do you have any assumptions how this can be done?

Thanks in advance!

Best regards,
Golubev Mikhail

Short answer: It can't.

Long answer: Vim cannot tell the current Caps Lock / Shift Lock / Scroll Lock state, it doesn't know when a key was released but only that it was pressed, and it doesn't know the Shift / Scroll / Alt state except sometimes (and not always in a way that vimscript can read) when some "ordinary" key gets pressed. And to make everything even more complex, there are some keys or key combinations that Vim never sees because they are snatched away before it can get them (e.g. on KDE Ctrl-F7 means "switch to virtual desktop #7", on Linux Ctrl-Alt-F5 means "switch to virtual text console #5 aka /dev/tty5); and in console mode it is also dependent on the underlying terminal for what, if anything, if will see for any particular key or key combination: for instance it is a well known (and intentional) fact that Shift makes no difference in conjunction with Ctrl-A to Ctrl-Z.

Best regards,
Tony.
--
World War Three can be averted by adherence to a strictly enforced
dress code!

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to