Open unnamedcookie opened 10 years ago
now if I build ctags and type
a.
then I get correct completion forabc()
. However, if I uncommentdef()
and don't rebuild the tags, I get-- Omni completion (^O^N^P) Pattern not found
The above line indicates that omni completion was executed, not user completion. As you can see in your comment below, supertab has bound itself to completefunc
, which is user completion, not omni.
My current config looks like this
let g:SuperTabCompletionContexts = ['s:ContextText', 's:ContextDiscover'] let g:SuperTabContextDiscoverDiscovery = ["&completefunc:<c-x><c-u>", "&omnifunc:<c-x><c-o>"]
You can probably remove these 2 lines. I doubt you actually need s:ContextDiscover
enabled.
let g:SuperTabContextTextOmniPrecedence = ['&omnifunc', '&completefunc']
I'm guessing this line above is the one causing your problems. That line tells supertab to use omni completion for context
completions if it's set, otherwise, if not set, use user completion. If you remove that line supertab will use its default of trying user completion first. I'll update the docs to make this more clear.
Also here's my
completefunc
andomnifunc
output::verbose set completefunc completefunc=SuperTabCodeComplete Last set from ~/.vim/bundle/supertab/plugin/supertab.vim :verbose set omnifunc omnifunc=omni#cpp#complete#Main Last set from ~/.vim/bundle/omnicppcomplete/autoload/omni/cpp/complete.vim
Here you can see supertab being bound to completfunc
which is user completion, but due to your config, supertab never attempts to use that function.
First of all, thank you for your help!
I'm guessing this line above is the one causing your problems.
That was a great guess, I've simply changed it to
let g:SuperTabContextTextOmniPrecedence = ['&completefunc', '&omnifunc']
and everything works. Also, everything works after removing two lines you've mentioned and this one altogether.
I'd swear that I've tried it to no avail. Going back to my example (and this is last question, I promise) when I hit tab after typing a.d
I get -- User defined completion (^U^N^P) match 1 of 2
and some random completion from C++ ctags, def()
not among them, but when I type a.de
and hit tab I get -- Keyword Local completion (^N^P) Back at original
which actually gives a.def
. It would be great if you could share your thoughts on this - is it a behavior specific to supertab?
Also, if I might have a humble suggestion, it's not entirely clear to me why g:SuperTabContextDefaultCompletionType exists when it has no effect without chaining and you actually have to provide second function in a chain anyway - maybe it could be explained slightly clearer in the doc?
I'd swear that I've tried it to no avail. Going back to my example (and this is last question, I promise) when I hit tab after typing a.d I get -- User defined completion (^U^N^P) match 1 of 2 and some random completion from C++ ctags, def() not among them, but when I type a.de and hit tab I get -- Keyword Local completion (^N^P) Back at original which actually gives a.def. It would be great if you could share your thoughts on this - is it a behavior specific to supertab?
This isn't specific to supertab. You should be able to reproduce the same result using a.d<c-x><c-u>
and then a.d<c-p>
. All that supertab really does is attempt to send the proper key sequence to vim. All these various supertab configuration settings and hooks are just there to tune supertab's decisions on what the proper key sequence to send to vim is. Once supertab has sent those keys, it's entirely up to the completion implementation (user, omni, keyword, etc) to decide what those completions are.
Also, if I might have a humble suggestion, it's not entirely clear to me why g:SuperTabContextDefaultCompletionType exists when it has no effect without chaining and you actually have to provide second function in a chain anyway - maybe it could be explained slightly clearer in the doc?
That setting is unrelated to completion chaining. Context completion works as follows:
g:SuperTabContextDefaultCompletionType
.
I'm not able to set supertab to fall back to keyword completion. I'm not sure if it is not the fault of omnicppcomplete.
Suppose I have the following piece of code in C++:
now if I build ctags and type
a.
then I get correct completion forabc()
. However, if I uncommentdef()
and don't rebuild the tags, I getinstead of falling back to
<c-p>
.My current config looks like this
Also here's my
completefunc
andomnifunc
output:I've went through the documentation and issues (here, here and here) but I'm still not able to make it work. I've tried adding chaining:
but it makes no difference.
I've tried different chaining configurations and since I'm completely out of ideas now, I would appreciate any help.
P.S. In case it might be relevant, here are also settings for omnicppcomplete: