Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix immediate popup on start #231

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 13 additions & 18 deletions autoload/which_key.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down