0

while Integrating ultisnip and supertab - I am trying to map F7 so if there are completion to be made with supertab or ultisnip - try to complete, otherwise if there are no suggested patterns (and ultisnip cant expand), ultisnip forwardsJump.

but complete_check() always return 0

let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<C-l>"
imap <expr> <F7> complete_check() == 0 ? "<\tab>" : "\<C-l>"

can somebody help me make it work? Thanks!!

suannai
  • 13
  • 4

1 Answers1

1

From :help complete_check():

Check for a key typed while looking for completion matches.
This is to be used when looking for matches takes some time.
Returns |TRUE| when searching for matches is to be aborted,
zero otherwise.
Only to be used by the function specified with the
'completefunc' option.

Are you sure complete_check() is the right tool for the job?

romainl
  • 186,200
  • 21
  • 280
  • 313
  • I couldn't find anything else.. I am looking for whatever function or var that can tell me if there are any completions to be made. The only one I found for now is pumvisible() but that is for after trying to complete already.. – suannai Aug 02 '20 at 04:37
  • 1
    Completion is done dynamically so you can only know if completion is possible *after* asking for completion. See `:help completion_info()`, which can be used as part of a quick `:help complete()` function or a more involved `:help complete-functions`. For your use case, `:help pumvisible()` seems to be the best approach. – romainl Aug 02 '20 at 11:23
  • Thank you, I am new to this world of code and vim. I will try reading and using :help pumvisible() as you suggested – suannai Aug 03 '20 at 06:24