Nice advices! Thanks a lot! I did a bit of googling and I think it's time come to dismiss this naughty key)
Best regards, Mikhail Golubev 2011/7/6 ZyX <[email protected]> > Reply to message <<Re: Caps Lock indication>>, > sent 20:08:16 06 July 2011, Wednesday > by Михаил Голубев: > > > Thanks for your attention and explanation Tony. So I will continue to > > guess Caps Lock state looking at mess on my screen :) and try to find > > another appropriate solution of my problem. > Answer <<it can't>> is false. While there is no possible system-independent > solutions in pure vimscript, system-dependent and/or not pure vimscript > solutions are possible: on linux (and any other system that uses X server), > for > example, you can invoke `xset q' (if xset is installed) and parse its > output to > get CapsLock state; maybe there is also some `file' in /proc or /sys which > can > be used for this purpose (I don't know for sure) (if it is, then you could > write > faster pure vimscript system-dependent solution). It also is not impossible > that > some python/perl/ruby/lua/... package contains cross-platform function > getCapsLockState. > > You should seek appropriate solution in this direction. > > Original message: > > Thanks for your attention and explanation Tony. So I will continue to > > guess Caps Lock state looking at mess on my screen :) and try to find > > another appropriate solution of my problem. > > > > Best regards, > > Golubev Mikhail > > > > On 6 июл, 19:01, Tony Mechelynck <[email protected]> wrote: > > > 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
