diff --git a/autoload/which_key.vim b/autoload/which_key.vim index f66c5ea..7227e99 100644 --- a/autoload/which_key.vim +++ b/autoload/which_key.vim @@ -109,24 +109,19 @@ function! which_key#start(vis, bang, prefix) " {{{ " parsed by vim-which-key itself with user defined prefix dictionary if avaliable. let s:runtime = s:create_runtime(mode, key) - if getchar(1) - while 1 - try - let c = getchar() - catch /^Vim:Interrupt$/ - return '' - endtry - if s:handle_char_on_start_is_ok(c) - return - endif - " When there are next level options, wait another timeoutlen. - " https://github.com/liuchengxu/vim-which-key/issues/3 - " https://github.com/liuchengxu/vim-which-key/issues/4 - if which_key#char_handler#wait_with_timeout() - break - endif - endwhile - endif + " When there are next level options, wait another timeoutlen. + " https://github.com/liuchengxu/vim-which-key/issues/3 + " https://github.com/liuchengxu/vim-which-key/issues/4 + while !which_key#char_handler#timeout_for_next_char() + try + let c = getchar() + catch /^Vim:Interrupt$/ + return '' + endtry + if s:handle_char_on_start_is_ok(c) + return + endif + endwhile endif let s:last_runtime_stack = [copy(s:runtime)]