On Wed, Jul 16, 2008 at 16:57, Tony Mechelynck
<[EMAIL PROTECTED]> wrote:
>> I've been using something like that for some time:
>>
>> inoremap<Esc>  <Right><Esc>
>>
>> This works in GVim but breaks extended keys in Vim (they send<Esc>  as
>> the first keycode).
>>
>> It seems that Vim doesn't wait a bit to see if another keycode
>> follows, but rather immediately applies the mapping. This does not
>> happen without the mapping, because in this case Vim correctly waits a
>> bit to see whether it's<Esc>  or an extended keycode. Not sure whether
>> this a bug or something desirable though...
>
> IIUC it is usually a side-effect of 'ttimeoutlen' being at its default
> of -1 (wait just as long for keycodes as for mappings). With something like
>
>        set timeout ttimeoutlen=100 timeoutlen=5000
>
> keycodes will timeout after one-tenth of a second (fast for a human, but
> usually quite lazy for a keyboard driver or a telecom line) while
> mappings will only timeout after five seconds (which should be ample for
> a human typist). Then if <Esc> is followed by something within one-tenth
> of a second it is examined for a keycode, but after that it still counts
> for a mapping.

Solely this does not work, because (if I got it correctly) the timeout
is the maximum time that Vim will wait to see whether a mapping has
been matched, not the minimum time. So when I hit <Esc>, Vim doesn't
wait at all, because a mapping already matched.

> If it still doesn't work, add
>
>        inoremap   <Esc><Esc>  <Esc>
>
> to force the full timeout (5s in my example) on the Esc key when not
> part of a keycode.

This works a bit better, but when I hit <Esc> to go back to normal
mode, Vim applies my first mapping and then it still waits during 5
seconds to see whether another mapping will match. If I hit an
extended key within those 5 seconds, the <Esc><Esc> mapping is
matched, and the second keycode is interpreted separately.

The best solution I could come up with was to map <Right><Esc> to
something than <Esc>. I'm used to the movement of the cursor upon
going back to the normal mode, but I still prefer when it doesn't
move.

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui