VimCompletesMe
VimCompletesMe copied to clipboard
auto trigger fallback
Isn't there any mean to trigger the fallback completion (that is, the generic vim completion) automatically if the special completions all failed (that is, b:completion_tried = 1
and pos
unchanged)?! This way, the user does not have to hit <tab>
twice.
I am open to suggestions. I do agree that the current method is really unintuitive. I thought of introducing another keybind for this but didn't like that method. the problem is that we have to tell Vim when to switch to fallback completion.
Yeah, there hopefully must some way, but Vim has so many quirks that it requires some guess work.
This would be really cool. Kind of what MuComplete does with it's completion#chain.
Btw, tried vcm_tab_complete = "user"
without any success. Tried it for python filetype and with set completefunc=jedi#completions
. Checking the value of vcm_tab_complete"
echoes me "user", but the completion used is omnicompletion omnifunc=pythoncomplete#Complete
and not the completefunc=jedi#completions
.
@josefson: Interesting. Jedi should be automatically overriding omnifunc here when initializing: https://github.com/davidhalter/jedi-vim/blob/026ae6be03323193850f83109a80982808a7621b/after/ftplugin/python/jedi.vim
Although, I'm not sure why omnifunc is still pointing to the pythoncomplete script.
Let me see if I can investigate this.
@josefson: Can you check if the latest master fixes the issue for you?
It would be interesting to compare VCM with mucomplete now that VCM also automatically falls back. As a layman, that seemed like the only difference.
@ajh17 It did the trick, thanks. @Konfekt while i like VCM simplicity, but i also like MuC chain. VCM fallback feature is one step in the chain direction, but only with 1 other completion method. I gotta thanks both actually for making me uninstall YCM and all the heavy lifting from vim.
Thanks, I'm only just found out about mucomplete. Seems pretty cool. I'll check it out further. Yeah if there's one area where I'd like to improve VCM, is the fallback.
This may be related. Try following.
- Type
foo/fo
and press tab - See that completion does not work
I assume that VimCompletesMe gets stuck in path-completion. I would expect if no path is found that keyword-completion should then be used and give me the suggestion foo
.
Maybe there is a way to have vim switch context automatically. If I do the following:
- Set completion to omni
- Try to complete a word which is in the buffer but not understood by omnicompletion
- (at this point I get the message that completion failed)
- Still in insert mode I do:
<C-r>=VimCompletesMe#vim_completes_me(0)<CR>
What I get is normal keyword completion, as if I press tab again.
I didn’t manage to do it in vimscript though... I’m new to this and trying to learn. I tried to append the above to return exp
but seems it doesn’t get executed.
Maybe you know how to get vim to do the <C-r>
thing? The idea could be to call a function that checks the completion status, using pumvisible() and cursor position, then either do nothing or call completion again?