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). Keeping the previously typed key will be very difficult. A workaround is to have all two-character commands check for the CursorHold key and handle it there. I'll look into this. I'm not sure this can be done, it may have other side effects (e.g., not redrawing). -- hundred-and-one symptoms of being an internet addict: 235. You start naming your kids Pascal, COBOL, Algol and Fortran. /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ download, build and distribute -- http://www.A-A-P.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
