Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Vimode problem (key press dropping)



On Wed, Jul 29, 2015 at 11:26 AM, Oliver Kiddle <okiddle@xxxxxxxxxxx> wrote:
> alx741@xxxxxxxxxx wrote:
>>
>> When i hit ESC two times the next letter is ignored, so in order to
>> enter insert mode i need to hit 'i'/'a' two times two. This is the same
>> for any even number of ESC, the problem is the same for 4 hits but no
>> for 3 times so i can say the second ESC hit leave the shell listening
>> and it just drop the next key press.
>
> The problem is that from vi command mode, the escape key is not bound to
> anything. If you bind escape to do absolutely nothing, the problem goes
> away.
>
>   bindkey -as '\e' ''
>
> Or alternatively, the following is what vim does:
>
>   bindkey -a '\e' beep
>
> Part of the reason behind the behaviour you see is that the cursor keys
> typically are bound and when you press the cursor keys, what zsh sees is
> an "escape sequence": a series of characters that start with an escape
> character. This also means that after seeing an escape character, zsh
> has to wait to see if more characters arrive. You might also want to
> tweak the KEYTIMEOUT variable to reduce this delay.
>
> Question to -workers subscribers: how should we address this in the
> defaults? I also have escape bound to set REGION_ACTIVE=0 from the
> visual keymap which should perhaps also be default behaviour (vim does
> that). Note that escape being a prefix character is what causes the
> subsequent 'i'/'a' to be ignored.
>
> Oliver

I always felt like how it should work if we get the string "abc", is
first abc is looked up and we find it isn't bound to anything, the a
gets treated as a separate input string, then we look up bc instead,
etc. What we do now is just discard the whole string as
"undefined-key".

-- 
Mikael Magnusson



Messages sorted by: Reverse Date, Date, Thread, Author