I'm trying to make Vim wait after the leader key indefinitely without messing with the timeoutlen of other keys. Currently I have this lines in my vimrc:

let mapleader=" "
set timeoutlen=2000 ttimeoutlen=0

Setting ttimeoutlen make commands such as ciw last permanently.

The Spacemacs plugin for Emacs which has a nice set of default configurations, one of these is that the leader key waits indefinitely. Can I do this on Vim by any other way than changing the timeoutlen values?

  • What do you mean by makeing the key persistent? Isn't it persistent, once you put this in your .vimrc? Jan 8, 2016 at 18:55
  • Sorry, I mean last longer. For example, in my case if I start type in normal mode "<leader>..." , the command only last for 2 seconds. What I want is Vim wait for the entire command or until I press ESC.
    – tjbrn
    Jan 8, 2016 at 19:03
  • You mean the timeout? Does :h 'timout' help you? Jan 8, 2016 at 19:05
  • 1
    Not much, since I can't found anything about key specific timeout. (I want just the leader key to wait the command)
    – tjbrn
    Jan 8, 2016 at 19:11

2 Answers 2


Here is a dirty workaround you could consider:

" Increase timeoutlen when <Leader> is pressed
" Only one of these lines is needed.  I am not sure which is most recommended.
"nmap <silent> <Leader> :<C-U>set timeoutlen=99999 ttimeoutlen=99999<CR><Leader>
nnoremap <silent> <Leader> :<C-U>set timeoutlen=99999 ttimeoutlen=99999<CR>:call feedkeys('<Leader>')<CR>

" Reset timeoutline to normal soon afterwards
autocmd CursorMoved * set timeoutlen=2000 ttimeoutlen=0

The CursorMoved event is not ideal but it usually gets triggered sooner or later. You may be able to find other events or mappings to reset the values in those cases when you get stuck on the long timeout.


If you do :set notimeout nottimeout mappings won't time out. This is all explained very well at :h 'timeout' You might try other combinations of those two mappings.

  • 3
    I think the OP wants to set the timeout options for specific keys. (such as making only the leader key not time out) Jan 8, 2016 at 21:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.