timeoutlen apply to mappings, such as netrw's
These are pretty straightforward: if you increase the length of
timeoutlen, then Vim will wait for longer after each keystroke of the mapping before aborting it and carrying out the behaviour of the keys typed so far. If you instead unset
timeout, then Vim will wait forever for you to either type the complete mapping or type something which doesn't match any of your mappings.
ttimeoutlen apply to key codes.
A common example of something sends key codes is the arrow keys. In the terminal presses of the arrow keys are generally represented by sequences of characters. You can see what (Vim thinks) your terminal is sending when you press e.g. the left arrow key by executing the command:
In my terminal, when I run the above, Vim outputs the following:
t_kl <Left> ^[O*D
This means that what my terminal sends to Vim when I press the arrow key is the sequences of characters: EscapeO*D.
^[ is a plain-text representation of the ESC character)
The only way that Vim can distinguish these sequences from actual keypresses is the speed with which it receives them, and you configure this with the
Thus, if you set
ttimeoutlen to a sufficiently large value (try
5000: five seconds) then you can move your cursor to the left by literally typing EscapeO*D on your keyboard.
However, this also means that if you press Escape in visual mode, then Vim will wait 5 seconds to whether you actually pressed Escape (to exit visual mode) or in fact just pressed Left in an extremely slow terminal.
Generally, you want to set
timeoutlen according to how quickly you generally type mappings, and you should set
ttimeoutlen to a pretty small value:
defaults.vim sets this to 100 milliseconds, but you can probably go a fair bit shorter than this without unwanted consequences.
Longer values of
ttimeoutlen are only required for "slow terminals or very busy systems" when key codes are timing out, but as processor and network speeds increase this is less and less of an issue in practice.