Peter Hodge wrote: > I am having trouble with getchar() detecting <ESC>. If I use getchar(0) or > getchar(1), it will not pick up an <ESC> keystroke. You can replicate this by > using the command: > > :sleep 3 | echo getchar(0) > > ... and pressing <ESC> quickly before the getchar() function is > called. In GUI Vim, I correctly see 27 returned by getchar(0), but in > Terminal Vim, getchar(0) is returning '0', even though <ESC> has been > pressed. Is this a bug in Vim?
It's because <Esc> is the start of a key sequence and it's incomplete. Vim can't know you pressed the <Esc> key instead of having received the first byte of a key sequence. -- Imagine a world without hypothetical situations. /// 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 ///