How do I make mappings feel snappier without breaking key-code timing?
Answer
:set timeout timeoutlen=400 ttimeoutlen=30
Explanation
If custom mappings feel laggy, the issue is often timeout tuning rather than mapping design. Vim waits for possible key-sequence continuations, and the defaults can feel slow when you use many leader mappings. Splitting timeoutlen from ttimeoutlen lets you keep reliable multi-key mappings while making terminal key-code handling feel immediate.
How it works
timeoutenables timeout logic for mapped key sequencestimeoutlen=400sets mapping wait time to 400ms, which is responsive without being too aggressive for leader combosttimeoutlen=30shortens terminal key-code timeout, reducing delay after keys like<Esc>in terminal environments
Example
Before tuning, pressing <leader>f may feel sticky when your leader is followed by many mapped alternatives, and exiting insert mode in a terminal can pause briefly.
Symptom: short delay after pressing mapped prefixes
Cause: long global timeout values
After applying the setting:
Mappings: still resolved correctly
Terminal keycodes: noticeably more responsive
Tips
- If 400ms is too short for your typing speed, raise
timeoutlengradually (for example, 500 or 600). - Keep
ttimeoutlenlow in terminal Vim; GUI clients often do not need the same tuning. - Put this in your config so behavior is consistent across sessions.