Sunday, May 23, 2010

Re: backspaces leaving Insert mode

On 21/05/10 17:58, Bee wrote:
> On May 21, 12:48 am, "John Beckett"<johnb.beck...@gmail.com> wrote:
>> NickC wrote:
>>> I've put up with this for years. Whenever I leave Insert
>>> mode by typing the Esc key, the cursor backtracks one char.
>>
>> 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:
> up ^[OA
> down ^[OB
> right ^[OC
> left ^[OD
>
> Since ^[ is the same as<esc>
> is ^[ doing<esc>`^
> as though it were typed?
>
> It seems up arrow is now doing:
> ^[ exit insert mode
> O Begin a new line above the cursor and insert text
> A type the letter "A"
>
> Why?
> .
>

Probably because Vim is not discriminating between mappings and keyboard
sequences. I recommend the following:

:set timeout timeoutlen=5000 ttimeoutlen=100

where:
'timeout' (boolean) enables timeout on mappings and keycodes
'timeoutlen' (milliseconds) is the timeout for mappings. It should be
longer than your slowest typing rate (when hesitating about what to type
next as part of a multikey mapping).
'ttimeoutlen' (milliseconds) is the timeout for keycodes. It should be
shorter than your fastest typing rate but longer than the rate at which
your keyboard driver sends the successive bytes of a multibyte keycode.

The timeouts may be longer or shorter depending on your typing speed and
the line speed between your keyboard and the computer where Vim is
running (which will usually be the computer next to you, but in some
cases it may be a remote computer accessed via X forwarding or ssh).


Best regards,
Tony.
--
A poem: read aloud:

<> !*''# Waka waka bang splat tick tick hash,
^"`$$- Caret quote back-tick dollar dollar dash,
!*=@$_ Bang splat equal at dollar under-score,
%*<> ~#4 Percent splat waka waka tilde number four,
&[]../ Ampersand bracket bracket dot dot slash,
|{,,SYSTEM HALTED Vertical-bar curly-bracket comma comma CRASH.

Fred Bremmer and Steve Kroese (Calvin College & Seminary of Grand
Rapids, MI.)

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