Here is some background to Vivian's answer.
If Vim only had single-letter commands, handling the "input buffer" you mention, in reality it's more like a queue, would be pretty easy:
- key is pressed,
- action associated with key is executed,
- repeat.
But Vim happens to have multi-letter commands, and also counts and motions, so handling that queue is not that simple in reality:
- key is pressed,
- another key is waited for disambiguating the first one,
- if first key is disambiguated, then associated action is executed,
- if not, another key is waited for,
- etc.
- if first key is not ambiguous anymore, associated action is executed,
- repeat.
Moreover, Vim allows you to create custom mappings, like your:
nnoremap _z "zyyq:
that may conflict with built-in commands, which is the case, here, with :help _
.
So, when you press _
, Vim is incapable of knowing that you want your _z
and not the built-in _
without waiting for you to press another key. If you press z
, then you get your mapping. If you press any other key, then you get the original _
.
In normal conditions, the default timeout should be imperceptible when doing _Z
, or any other _<key>
combination, because you break out of the timeout. But of course, you may be typing too slowly, or your terminal may be too slow, or your network may introduce too much latency. In those cases, Vim lets you decide how it should handle the problem with four options:
:help 'timeout'
:help 'timeoutlen'
:help 'ttimeout'
:help 'ttimeoutlen'
as in Vivian's answer.