On 8/25/06, Bram Moolenaar <[EMAIL PROTECTED]> wrote:
Gary Johnson wrote: > On 2006-08-25, Max Dyckhoff <[EMAIL PROTECTED]> wrote: > > > > From: A.J.Mechelynck [mailto:[EMAIL PROTECTED] > > > Sent: Friday, August 25, 2006 12:36 PM > > > > Max Dyckhoff wrote: > > > > Recently something rather annoying has started happening; key > > > > codes have started occasionally timing, despite my express > > > > desire for them to never time out. notimeout and nottimeout > > > > are both set. > > > > > > > > If I move to a place in the file and type ^W quickly and then > > > > pause before typing ], then it will timeout after around a > > > > second. If I move to a place in the file and then wait for a > > > > small period of time, the ^W will no longer time out. > > > > > > > > It looks like something related to the CursorHold time is > > > > happening, but I can't for the life of me work out what it is. > > > > Any ideas? > > > > As your subject hints, try > > > > > > :verbose set timeout? ttimeout? timeoutlen? ttimeoutlen? > > > > > > then read the help about these 4 options. > > > > > > In a nutshell, to have Vim time out after 0.25 second for multibyte > > > keycodes (generated by the keyboard driver) and after only 5 seconds > > > when you're typing the {lhs} of a mapping, use > > > > > > :set timeout ttimeoutlen=250 timeoutlen=5000 > > > > > > To time out after 0.1 second for keycodes and never for mappings, use > > > > > > :set notimeout ttimeout ttimeoutlen=100 > > > > > > etc. The default is one second for both. > > > I'm sorry, perhaps I wasn't being clear enough. I don't want a timeout > > to ever occur for a mapping. timeout and ttimeout are both set to "no" > > (or whatever the correct syntax for describing such options is). > > > > Here are two use cases. Again, I apologise for the clumsy syntax. > > > > 1) > > * Move cursor > > * Type ^w > > * Wait updatetime from cursor movement > > * Observe mapping timeout > > > > 2) > > * Move cursor > > * Wait updatetime > > * Type ^w > > * Observe no mapping timeout > > > > If I set updatetime=1 then the timeout never occurs, because the second > > use case is followed, but I want updatetime to be around 1000. :verbose > > au CursorHold shows that the only CursorHold au is one set from > > ctags.vim: > > > > autocmd CursorHold * > > \ if generate_tags != 0 > > \ | call s:SetTagDisplay() > > \ | endif > > > > Is this au timing out my mapping? Can I make it stop doing so without > > removing the au or altering the updatetime? > > I can verify this behavior and that removing the CursorHold > autocommand "fixes" the problem. It may be a bug in Vim. I > reported a similar problem with the 7.0b or 7.0c release that did > turn out to be a bug in the event handler. > > It's not just mappings that are affected. With the following > settings: > > showcmd > notimeout > nottimeout > updatetime=500 > > and the ctags.vim CursorHold autocommand enabled, if I type a > cursor-movement command (such as 'j') immediately followed by a > double-quote to start a register name, the double-quote briefly > appears in the 'showcmd' area, then disappears with a beep. If I > increase 'updatetime' to 5000 and repeat the experiment, the > double-quote stays for about 5 seconds before disappearing. > > It looks to me like an undesirable interaction between processing of > the CursorHold autocommand and processing of commands from the > keyboard. Bram? > > I should mention that I'm using the 7.0 release, unpatched. I'm > working on bringing it up to the current patch level, but I'm not > done with that yet. When the CursorHold autocommand triggers it puts a keycode in the input buffer. A half-typed command will be ended by this, possibly by with an error (beep/flash).
I don't understand your explanation, Bram. If your explanation were valid, then *any* 'au CursorHold' would cancel multi-key commands like gg. But this is not the case. Simple assignmet 'let foo=xyz' in 'au CursorHold' does not cause multi-key-commands-cancelation. But then your explanation, Bram, is not valid, no ? As Max and Gary pointed out, and as I see myself, only some "difficult" commands in 'au CursorHold' cause breakage of multi-key commands. For myself, I always have 'set updatetime=200' and 'au CursorHold * let xxx=yyy' and multi-key breakage does not happen for me. I don't know whcih exactly commands in 'au CursorHold' cause breakage. Did anybody track this ? Yakov
