How do I make a key mapping fire immediately without waiting for longer mappings to time out?
Answer
nnoremap <nowait> {key} {action}
Explanation
The <nowait> flag on a mapping tells Vim not to delay waiting for a longer key sequence. Normally, when you press a key that is the prefix of another mapping, Vim waits for timeoutlen milliseconds to see if you'll type more keys. With <nowait>, the mapping fires immediately the moment Vim can match it.
How it works
By default, if you have these two mappings:
nnoremap <leader>f :find<CR>
nnoremap <leader>ff :Files<CR>
After pressing <leader>f, Vim pauses and waits — if you type f again it runs <leader>ff; otherwise, after the timeout it runs <leader>f. Adding <nowait> to the shorter mapping eliminates that pause:
nnoremap <nowait> <leader>f :find<CR>
Now <leader>f fires immediately without any delay, even though <leader>ff still exists.
Example
Useful in plugin configurations where you want a root key to respond instantly:
" Bind <leader>d to a quick action, skip the pause
nnoremap <nowait> <leader>d :bdelete<CR>
" Longer binding still works when typed quickly
nnoremap <leader>dd :bdelete!<CR>
Pressing <leader>d now runs :bdelete without waiting. Pressing <leader>dd quickly still triggers the second mapping.
Tips
<nowait>only matters when the same key is a prefix of another mapping in the same mode- Consider using
<nowait>on your most frequently used mappings to eliminate thetimeoutlendelay - Combine with
set timeoutlen=500to tune the default wait time for mappings without<nowait> - The
<nowait>flag can be applied in any mapping command:nnoremap,vnoremap,inoremap, etc.