inoremap <esc> bug?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

inoremap <esc> bug?

Bee-16
inoremap <esc> bug?

http://vim.wikia.com/wiki/Avoid_the_escape_key

I tried the "Improving the Esc key" on that page.

inoremap <Esc> <Esc>`^

In Mac terminal and Linux urxvt it has side effects for the arrow
keys. The arrow keys up, down, right, left produce A, B, C, D
respectively.

Hmmm, vim keycodes found using ^V:
up     ^[OA
down   ^[OB
right  ^[OC
left   ^[OD

Since ^[ is the same as <esc>
Is the ^[ doing <esc>`^ as though it were typed?

It seems up arrow is now doing:
^[  Exit insert mode
`^  To position where the cursor was the last time when Insert mode
was stopped
O   Begin a new line above the cursor and insert text
A   Type the letter "A"

Is this a bug? Seems inoremap is not working here.

--
You received this message from the "vim_dev" 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 | Threaded
Open this post in threaded view
|

Re: inoremap <esc> bug?

Tony Mechelynck
On 25/05/10 18:03, Bee wrote:

> inoremap<esc>  bug?
>
> http://vim.wikia.com/wiki/Avoid_the_escape_key
>
> I tried the "Improving the Esc key" on that page.
>
> inoremap<Esc>  <Esc>`^
>
> In Mac terminal and Linux urxvt it has side effects for the arrow
> keys. The arrow keys up, down, right, left produce A, B, C, D
> respectively.
>
> Hmmm, vim keycodes found using ^V:
> up     ^[OA
> down   ^[OB
> right  ^[OC
> left   ^[OD
>
> Since ^[ is the same as<esc>
> Is the ^[ doing<esc>`^ as though it were typed?
>
> It seems up arrow is now doing:
> ^[  Exit insert mode
> `^  To position where the cursor was the last time when Insert mode
> was stopped
> O   Begin a new line above the cursor and insert text
> A   Type the letter "A"
>
> Is this a bug? Seems inoremap is not working here.
>

I recommend

        :set timeout timeoutlen=5000 ttimeoutlen=100

(or similar), where

- both times are in milliseconds

- 'timeoutlen' should be longer than the longest time between keystrokes
when you're hesitating about which key to type next in a multikey {lhs}
for a mapping

- 'ttimeoutlen' should be shorter than the shortest time between
keystrokes at your fastest typing speed but longer than the (longest)
time between successive bytes sent to you by the keyboard for a single key.

When bytes arrive with a shorter interval between them than
'ttimeoutlen' milliseconds, Vim will then accept them as a multibyte
keycode (if found in the current termcap) in preference to a mapping.

See the corresponding help topics for details.


Best regards,
Tony.
--
Real World, The n.:
        1. In programming, those institutions at which programming may
be used in the same sentence as FORTRAN, COBOL, RPG, IBM, etc.  2. To
programmers, the location of non-programmers and activities not related
to programming.  3. A universe in which the standard dress is shirt and
tie and in which a person's working hours are defined as 9 to 5.  4.
The location of the status quo.  5. Anywhere outside a university.
"Poor fellow, he's left MIT and gone into the real world."  Used
pejoratively by those not in residence there.  In conversation, talking
of someone who has entered the real world is not unlike talking about a
deceased person.

--
You received this message from the "vim_dev" 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 | Threaded
Open this post in threaded view
|

Re: inoremap <esc> bug?

Bee-16
On May 25, 1:19 pm, Tony Mechelynck <[hidden email]>
wrote:

> On 25/05/10 18:03, Bee wrote:
> > inoremap<esc>  bug?
>
> >http://vim.wikia.com/wiki/Avoid_the_escape_key
>
> > I tried the "Improving the Esc key" on that page.
>
> > inoremap<Esc>  <Esc>`^
>
> > In Mac terminal and Linux urxvt it has side effects for the arrow
> > keys. The arrow keys up, down, right, left produce A, B, C, D
> > respectively.
>
> > Hmmm, vim keycodes found using ^V:
> > up     ^[OA
> > down   ^[OB
> > right  ^[OC
> > left   ^[OD
>
> > Since ^[ is the same as<esc>
> > Is the ^[ doing<esc>`^ as though it were typed?
>
> > It seems up arrow is now doing:
> > ^[  Exit insert mode
> > `^  To position where the cursor was the last time when Insert mode
> > was stopped
> > O   Begin a new line above the cursor and insert text
> > A   Type the letter "A"
>
> > Is this a bug? Seems inoremap is not working here.
>
> I recommend
>
>         :set timeout timeoutlen=5000 ttimeoutlen=100
>
> (or similar), where
>
> - both times are in milliseconds
>
> - 'timeoutlen' should be longer than the longest time between keystrokes
> when you're hesitating about which key to type next in a multikey {lhs}
> for a mapping
>
> - 'ttimeoutlen' should be shorter than the shortest time between
> keystrokes at your fastest typing speed but longer than the (longest)
> time between successive bytes sent to you by the keyboard for a single key.
>
> When bytes arrive with a shorter interval between them than
> 'ttimeoutlen' milliseconds, Vim will then accept them as a multibyte
> keycode (if found in the current termcap) in preference to a mapping.
>
> See the corresponding help topics for details.

Hi Tony

I tried what you suggested and it had no effect, tried other values,
still get the A, B, C, D.

Also tried with:
vim -N -i NONE -u NONE

Still getting:
The arrow keys up, down, right, left produce A, B, C, D respectively.

--
You received this message from the "vim_dev" 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 | Threaded
Open this post in threaded view
|

Re: inoremap <esc> bug?

Matt Wozniski-2
On Tue, May 25, 2010 at 4:53 PM, Bee <[hidden email]> wrote:

> On May 25, 1:19 pm, Tony Mechelynck <[hidden email]>
> wrote:
>> On 25/05/10 18:03, Bee wrote:
>> > Is this a bug? Seems inoremap is not working here.
>>
>> I recommend
>>
>>         :set timeout timeoutlen=5000 ttimeoutlen=100
>>
>> (or similar), where
>>
>> - both times are in milliseconds
>>
>> - 'timeoutlen' should be longer than the longest time between keystrokes
>> when you're hesitating about which key to type next in a multikey {lhs}
>> for a mapping
>>
>> - 'ttimeoutlen' should be shorter than the shortest time between
>> keystrokes at your fastest typing speed but longer than the (longest)
>> time between successive bytes sent to you by the keyboard for a single key.
>>
>> When bytes arrive with a shorter interval between them than
>> 'ttimeoutlen' milliseconds, Vim will then accept them as a multibyte
>> keycode (if found in the current termcap) in preference to a mapping.
>>
>> See the corresponding help topics for details.
>
> Hi Tony
>
> I tried what you suggested and it had no effect, tried other values,
> still get the A, B, C, D.
>
> Also tried with:
> vim -N -i NONE -u NONE
>
> Still getting:
> The arrow keys up, down, right, left produce A, B, C, D respectively.

Yes, this is a known vim bug that has been reported multiple times -
at least once by me.

~Matt

--
You received this message from the "vim_dev" 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