Peter Knaggs wrote:
On 12/10/06, A.J.Mechelynck <[EMAIL PROTECTED]> wrote:


I can't type fast enough

I noticed by looking in getchar.c at line 2695 that the timeout
"p_ttm" is a global,
which we can set (in milliseconds) using "set ttimeoutlen <value>"
(see option.c).
So e.g. to set it to three seconds, to give yourself more time to type in the
interactive testcase, we can use:

set ttimeoutlen=3000

I'm intentionally setting 'ttimeoutlen' to faster than I can hope to type, since its use is to distinguish between multibyte special keys (which the keyboard driver enters very fast into the buffer) and, for instance, multibyte mappings (whose 'timeoutlen' is intentionally slower than I type even when I type slowly):

set timeout timeoutlen=5000 ttimeoutlen=250


I'm beginning to understand the concept described in ":help ttimeoutlen",
apparently it has something to do with defining macro sequences, e.g. if
for some reason I wanted to define a macro called "OK" to string-replace
"ko" with "ok", I'd do something like this:
 :map OK :s/ko/ok/<CR>
Then the command ":map" would show the mapping like this:
  OK            :s/ko/ok/<CR>
To execute the macro, then, I'd type Esc OK. But by default, there
are no macro sequences starting with O, right?

I'm wondering if there's some mistake causing vim to think there's a macro
sequence associated with Esc O, which is causing vim to use the timeout,
whereas pressing O separately immediately inserts a line above?

Apparently, the sequence Esc O is a a little different by default in that
it seems to always incur a one-second timeout, whereas the other keys
which invoke insert mode don't seem to have any timeout: Esc o, Esc A,
Esc i don't have any timeout. Maybe the Esc O timeout is something I just
hadn't noticed before in vi, but it seems new in vim. It happens whether or
not "set nocompatible" is used.

Regards,
Peter.


'ttimeoutlen' (if greater than zero and 'timeout' and 'ttimeout' are not both FALSE) is the timeout for the individual bytes of multibyte special keys entered into the buffer by your keyboard driver. Therefore it should be faster than you can type but slower than your keyboard driver or (if inputting over a slow transmission line) than your serial line. (If 'timeout' is TRUE and 'ttimeoutlen' is negative the value of 'timeoutlen' will be used.)

'timeoutlen' (if 'timeout' is TRUE) is the timeout for multibyte mappings, whose bytes you type one after another at the keyboard. Therefore it should be slower than you can type, but not too slow so if you wait for longer than the timeout whatever was already typed will be input into the buffer.

I set 'ttimeoutlen' to one-quarter of a second and 'timeoutlen' to five seconds but YMMV.


Best regards,
Tony.

Reply via email to