prabirshrestha / asyncomplete.vim

async completion in pure vim script for vim8 and neovim
MIT License
925 stars 60 forks source link

Complete only on tab keypress #5

Closed andreypopp closed 7 years ago

andreypopp commented 7 years ago

It looks like asyncomplete tries to complete on any buffer change by default. Is it possible to only try to complete when user explicitly asks for it — on Tab keypress, for example?

prabirshrestha commented 7 years ago

Currently this feature is not supported. I deliberately didn't support it or at least unless someone asked for it. Since I like VS and VSCode style completion I made the algorithm similar to how they work and I have not heard anyone customizing the default behavior in VS. (more details at https://github.com/prabirshrestha/asyncomplete.vim/pull/3 and https://github.com/roxma/nvim-completion-manager/issues/30#issuecomment-283281158).

That said I open to adding this feature. I will be busy for couple of days so won't have time to look at it but should be fairly simple to send a PR for this. You would need to modify s:python_cm_refresh function and if a:force is false and g:asyncomplete_auto_popup (new option) is false and pumvisible() is false do nothing. Then map tab as trigger key imap <tab> <Plug>(asyncomplete_force_refresh). This is already supported and documented in README.md. By default I would set g:asyncomplete_auto_popup to be 1.

Once neovim official releases lua remote plugin support I plan to write the matcher func similar to VS in lua so hopefully it will be better there. If possible I may also be able to make that lua work in vim8.

andreypopp commented 7 years ago

Ok, thanks for the hints — I'll try to take a stab on it.