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
-- 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 |
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 |
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 <[hidden email]> 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 |
In reply to this post by Михаил Голубев
Михаил Голубев wrote on 06/07/2011 04:01 PM:
> 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 > than a couple of minutes per day, I change Caps Lock into Shift instead. I do not require the use of Caps Lock, especially not when using Vim ;-) Instructions for remapping Caps Lock differs based on your Operating System/Terminal/Desktop Environment. Google should fetch it for you in no time. -- .----------------------------------------------------------. | Albie Janse van Rensburg | | Respect! ~ http://www.dtcc.edu/cs/rfc1855.html | '----------------------------------------------------------' I didn't believe in reincarnation in any of my other lives. I don't see why I should have to believe in it in this one. -- Strange de Jim -- 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 |
In reply to this post by Михаил Голубев
On Jul 6, 9:08 am, Михаил Голубев <[hidden email]> wrote: > 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 <[hidden email]> 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! I have remapped Caps Lock on all of my machines, Mac, Linux, and WinXP to the Control key. That solves two problems. Is that an option for you? -Bill -- 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 |
In reply to this post by Михаил Голубев
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 <[hidden email]> 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! |
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 <[hidden email]> Reply to message «Re: Caps Lock indication», 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 to message «Re: Caps Lock indication»,
sent 21:53:33 06 July 2011, Wednesday by Михаил Голубев: Yes, replacing caps lock with something more useful is the best solution for me: I have left control there (and Esc on `real' left control). First is done by ctrl:nocaps xkb option, second by line `keycode 37 = Escape' in ~/.Xmodmap (on your machine number after `keycode' may differ). Of course, this works only for X server. I don't know any windows or mac solutions for this problem. Original message: > 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 <[hidden email]> > > > 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 <[hidden email]> 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! |
In reply to this post by Михаил Голубев
On Jul 6, 9:01 am, Михаил Голубев <[hidden email]> 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! > I use this instead of capslock: http://vim.wikia.com/wiki/Insert-mode_only_Caps_Lock With this, I DO get an indication of when it is active, but even better, I am able to automatically leave caps-lock mode when I leave insert mode! -- 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 |
In reply to this post by Nikolay Aleksandrovich Pavlov
On Jul 6, 11:20 am, ZyX <[hidden email]> wrote: > Reply to message «Re: Caps Lock indication», > sent 21:53:33 06 July 2011, Wednesday > by Михаил Голубев: > > Yes, replacing caps lock with something more useful is the best solution for me: > I have left control there (and Esc on `real' left control). First is done by > ctrl:nocaps xkb option, second by line `keycode 37 = Escape' in ~/.Xmodmap (on > your machine number after `keycode' may differ). > > Of course, this works only for X server. I don't know any windows or mac > solutions for this problem. > > Original message: > > > > > 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 <[hidden email]> > > > > 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 <[hidden email]> 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! > > signature.asc > < 1KViewDownload On the Mac it is in System Preferences: Apple Menu > System Preferences > Keyboard & Mouse > Keyboard > Modifier Keys > Caps Lock Key: > Control -Bill -- 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 |
In reply to this post by Михаил Голубев
On 06.07.11 21:53, Михаил Голубев wrote:
> Nice advices! Thanks a lot! > > I did a bit of googling and I think it's time come to dismiss this naughty > key) Especially on laptops, mapping it to escape is a significant convenience, because escape is usually tiny and far away. Eliminating CapsLock is a useful bonus. On a couple of laptops, and two desktops, I've done it like this: To change CAPS_LOCK to ESCAPE, put into ~/.Xmodmap: keycode 0x42 = Escape clear Lock # Disable Caps-Lock In nearly a decade without it, I'm yet to find a need for CapsLock. (There were quite a few capitalised token names in some yacc I typed in the last few hours, but the left little finger handles that without thought.) Erik -- Habit is habit, and not to be flung out of the window by any man, but coaxed down-stairs a step at a time. -- Mark Twain, "Pudd'nhead Wilson's Calendar -- 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 |
On 07 Jul 2011, Erik Christiansen wrote:
> On 06.07.11 21:53, Михаил Голубев wrote: > > Nice advices! Thanks a lot! > > > > I did a bit of googling and I think it's time come to dismiss this naughty > > key) > > Especially on laptops, mapping it to escape is a significant > convenience, because escape is usually tiny and far away. Eliminating > CapsLock is a useful bonus. > > On a couple of laptops, and two desktops, I've done it like this: > > To change CAPS_LOCK to ESCAPE, put into ~/.Xmodmap: > keycode 0x42 = Escape > clear Lock # Disable Caps-Lock > > In nearly a decade without it, I'm yet to find a need for CapsLock. > (There were quite a few capitalised token names in some yacc I typed in > the last few hours, but the left little finger handles that without > thought.) > > Erik I do the same on my desktop and three laptops. For some reason .Xmodmap wasn't working for me so I put it in .xinitrc, along with various other key remappings. Anthony -- Anthony Campbell - [hidden email] Microsoft-free zone - Using Debian GNU/Linux http://www.acampbell.org.uk - sample my ebooks at http://www.smashwords.com/profile/view/acampbell -- 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 |
In reply to this post by Михаил Голубев
On Wed, Jul 6, 2011 at 11:01 AM, Михаил Голубев <[hidden email]> wrote: Hello to everyone. An option is installing an indicator for that on your OS. If on Ubuntu, http://www.omgubuntu.co.uk/2010/09/indicator-keylock-ubuntu/.
-- 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 |
Free forum by Nabble | Edit this page |