suannai
suannai

Reputation: 13

vim - how to use complete_check() on mapping

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!!

Upvotes: 0

Views: 63

Answers (1)

romainl
romainl

Reputation: 196516

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?

Upvotes: 1

Related Questions