VimCompletesMe icon indicating copy to clipboard operation
VimCompletesMe copied to clipboard

auto trigger fallback

Open Konfekt opened this issue 9 years ago • 10 comments

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.

Konfekt avatar Feb 17 '16 16:02 Konfekt

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.

ackyshake avatar Feb 18 '16 06:02 ackyshake

Yeah, there hopefully must some way, but Vim has so many quirks that it requires some guess work.

Konfekt avatar Feb 18 '16 20:02 Konfekt

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 avatar Nov 01 '16 20:11 josefson

@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.

ackyshake avatar Nov 02 '16 06:11 ackyshake

@josefson: Can you check if the latest master fixes the issue for you?

ackyshake avatar Nov 02 '16 07:11 ackyshake

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.

Konfekt avatar Nov 02 '16 09:11 Konfekt

@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.

josefson avatar Nov 02 '16 18:11 josefson

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.

ackyshake avatar Nov 03 '16 06:11 ackyshake

This may be related. Try following.

  1. Type foo/fo and press tab
  2. 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.

astier avatar Jul 05 '19 15:07 astier

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?

ghetto-ch avatar Feb 18 '20 19:02 ghetto-ch