On 08/20/2016 01:22 PM, Bram Moolenaar wrote: > Hirohito Higashi wrote: >> `set ttimeoutlen=0` will solve the above. >> >> I have invested in above setting more than a year, but the >> trouble does not happen even once. > > Zero only works when you are directly using a terminal. When > using a remote shell it might not work properly. But one > second is indeed too much. > > I have it set to 200, this still has some lag. I think 100 > would work for just about everyone.
I ran for a long time without trouble using 50 milliseconds. But even this eventually proved too long once I began using Alt-letter mappings in console Vim. The key sequence for Alt-j is <Esc>j. I would frequently press <Esc> to exit insert mode followed quickly by the j key, and Vim would misinterpret the sequence as Alt-j (which would then invoke my insert-mode mapping for Alt-j). I found experimentally that I could set ttimeoutlen to 5 to avoid most instances of this kind of incorrect key interpretation. This value has never proved to be too small in my use. I've never noticed a case of Vim timing out in the middle of a valid multi-key sequence and splitting it incorrectly into multiple keypresses, even when using Vim across an SSH connection; however, these connections were typically done over a local Ethernet, so on a slower network it's possible that such splitting could occur (such that Alt-j might be split erroneously into <Esc> followed by j). I consider this an unlikely case, since the multi-key sequence will probably be written to the network as a unit and carried in a single network packet, regardless of the speed of the network; still, until we start using uniquely decodable key sequences so we don't have to rely on timeouts, there will always be some risk of incorrect key interpretation. I think 100ms is better than 200ms as a default. I wouldn't suggest a default as low as 5ms due to the possible risk of misinterpreting multi-byte key sequences, even though I've never personally noticed such a failure. Users like myself who require shorter values can always override the default. I'll also note that I've seen 100ms used elsewhere, such as in Tim Pope's "Sensible Defaults" plugin: https://github.com/tpope/vim-sensible/blob/master/plugin/sensible.vim#L28 Michael Henry -- -- 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 --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.