Thursday, May 26, 2011

Re: Keyboard left in a strange mode after ZZ

On 27/05/11 1:02 AM, Richard Guse wrote:
> I'm using Vim 7.3 7/20/2010 under Windows 7.
>
> I usually start gvim from the command-line but sometimes from Windows Explorer.
>
> After I start, do my work then use "ZZ" to save/exit, it leaves the keyboard in a
> strange state relating only to the window which was used to start gvim:
>
> before: abc123
> after: ABC!@#
> after (shift key): ABC!@#
> after (caps lock): abc!@#
>
> There seem to be two ways to fix it...
>
> 1. exit and restart the window
> 2. in a bad window, re-start vim then type any command...even typing ":" and
> exiting the window with the mouse works. Just starting it then closing the window
> doesn't fix it - something must be typed.
>
> This doesn't happen with vim.
> This doesn't happen with gvim if exited with :wq or :x.
>
> I haven't noticed this behavior with any other application.
>
> I've noticed several tips and messages relating to mapping caps lock to escape but
> I don't map default keys.
>
> I'm hoping someone here has seen this before as its driving me nuts. It is
> incredibly difficult to retrain myself to :wq or :x rather than ZZ. I even tried
> mapping ZZ to :x and it still happens.
>
> Thanks.
>
> ->Richard Guse

Hmm. I guess it happens because Gvim does something keyboard-related
when it exits, but when you use ZZ, at that point the shift key is
depressed. To test the theory try doing

:noremap ZZ 2gsZZ

That will put in a 2 second delay before exiting, which should be more
than enough time for you to release the shift key. See if that helps. If
it does, check you can reproduce the bad behaviour by continuting to
hold the shift key until after the 2 second delay passes and Vim exits.

Ben.

--
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

No comments: