Closed habamax closed 5 years ago
And just in case, setup that worked for me (tab to trigger snippet or jump to next placeholder or open completion menu or complete next):
" UltiSnips and Completor {{{
if has('python') || has('python3')
let g:UltiSnipsExpandTrigger = '<tab>'
let g:UltiSnipsJumpForwardTrigger = '<tab>'
packadd ultisnips
" Completor and ultisnips to reuse TAB key
fun! Tab_Or_Complete() "{{{
call UltiSnips#ExpandSnippet()
if g:ulti_expand_res == 0
if pumvisible()
return "\<C-n>"
else
call UltiSnips#JumpForwards()
if g:ulti_jump_forwards_res == 0
" If completor is not open and we are in the middle of typing a word then
" `tab` opens completor menu.
let inp_str = strpart( getline('.'), col('.')-3, 2 )
if col('.')>1 && (inp_str =~ '^\w$' || inp_str =~ '\%(->\)\|\%(.\w\)\|\%(\w\.\)\|\%(./\)')
return "\<C-R>=completor#do('complete')\<CR>"
else
return "\<TAB>"
endif
endif
endif
endif
return ""
endf "}}}
au InsertEnter * exec "inoremap <silent> " . g:UltiSnipsExpandTrigger . " <C-R>=Tab_Or_Complete()<cr>"
" should be together if auto trigger is off
let g:completor_complete_options = "menuone,preview"
let g:completor_min_chars = 1
let g:completor_auto_trigger = 0
packadd completor.vim
endif
Looks like you have changed it to use timers...
I am not sure if the following is a proper way to fix my issue but:
function! completor#do(action) range
if exists('s:timer') && !empty(timer_info(s:timer))
call timer_stop(s:timer)
endif
let meta = {'range': [a:firstline, a:lastline]}
let status = completor#action#current_status()
let s:timer = timer_start(g:completor_completion_delay, {t->s:do_action('complete', meta, status)})
return ''
endfunction
I have just added return ''
to the function.
PS
By the way, now your new version of the function do not propagate action
parameter to s:do_action
function as it was in previous versions. If this is intended behavior, param from completor#do(action)
could be removed, probably?
Thanks for reporting! This is a bug. And the commit f5bddd6f0c488b95e3ea4052140338a4e3a923c2 fixed it.
Thx! Looks like it is fixed for me!
Looks like after the latest update of the plugin I can no longer call
completor#do('complete')
to call completion. Now it returns0
as a text.How can I manually call completor completion now? (I use it with
tab
together with ultisnips and it worked for me well)