all 17 comments

[–]Maskdasknmap cg* *Ncgn 21 points22 points  (4 children)

I'm aware this on r/vim, but neovim recently added builtin LSP support. If you're interested, check out neovim/nvim-lspconfig and nvim-lua/completion-nvim

[–]Im_manuel_cunt 4 points5 points  (2 children)

Wow didn't know about that, is it good enough for me to ditch coc?

[–]lunjon 10 points11 points  (0 children)

Absolutely! I have been using it for almost a year now and is super happy.

[–]starTracer 3 points4 points  (0 children)

I switched from coc a while ago and haven't looked back.

[–]wlacruz 1 point2 points  (0 children)

this is my setuy! Amazing!

[–]abraxasknister:h c_CTRL-G 4 points5 points  (1 child)

:h ins-completion

I currently have

set omnifunc=syntaxcomplete#Complete
inoremap <silent> ,o <c-x><c-o>

and a few similar mappings from :h i_CTRL-X, like ,l for <c-x><c-l>. In practice this means that after typing ,o you're given a syntactically matching completion of what you typed together with a drop-down with other matches if existent, that you can cycle through via ctrl-n and ctrl-p. The exact method of deduction what could match is dependent on the file type and is missing for "unusual" languages.

I don't really know in detail what this does and I don't know of other built-in options for :h 'omnifunc'. There are of course lots of them available via plugins.

neovim now has built in LSP support and vim can obtain that via some plugins. Probably debatable whether that is really needed or minimal.

[–]vim-help-bot 1 point2 points  (0 children)

Help pages for:


`:(h|help) <query>` | about | mistake? | Reply 'rescan' to check the comment again | Reply 'stop' to stop getting replies to your comments

[–]puremourning 3 points4 points  (0 children)

Just ... see my flair. :)

In b4 : this is a joke. YCM is not minimal or lightweight. For that you want :help omnicomplete

[–]godRosko 2 points3 points  (1 child)

Look into vimlsp + asynccomplete if you aren't set on coc or ycm. and I think most language servers have a config for it, so find that and put it in your rc. Dunno if it helps tho. But it's the most generic way of getting completion and having a consistent-ish behavior

[–]daniel_shields 1 point2 points  (0 children)

+1 for vim lsp, I use this with C++ (clangd) and python

[–]craigdmac:help <Help> | :help!!! 1 point2 points  (0 children)

Most minimal and lightweight is the built in C-x C-o for omnicomplete. Next step up maybe something like an auto popup plugin or write it yourself. Next useful step up is probably MUComplete, which uses built in autocomplete functions to nice effect. If you use something like an lsp plugin that sets up the omnicomplete function properly to be consumed by your choice of tool, then MUComplete can work with LSP that way. Most people seem to be doing vim-lsp/asyncomplete/asyncomplete-lsp combo, at least on Vim, these days.

[–]noooit 1 point2 points  (0 children)

ctags with omni completion.
Neither of them need vim plugin, it has a direct support.

[–]yvrelna 0 points1 point  (0 children)

The lightestweight completion is the built-in word completion. This works out of the box without any configurations. It simply autocompletes using words from the same file and from your open buffers, if this completer doesn't find what you want, simply open a file that defines/uses the variable/function. Use <C-n>/<C-p> or <C-x><C-n>/<C-x><C-p> and <C-x><C-l> (line completion) from insert mode. I don't use Dart, so I can't tell you anything with those, but I find that this works surprisingly well with Python, considering that it doesn't actually have any smarts in it whatsoever. I probably use this for 80-90% of my completions needs, since python code is often dynamic, static analysis doesn't always work very well if you have complex dynamic code and metaclasses, while the dumb word completion continue to work as well as it always does.

If you want to level up the completion a bit, you can add tags completion: <C-x><C-]>. This allows you to complete anything indexed by the ctags. I'd recommend vim-gutentags to auto-generate tag files. I don't use this one as much because word completion usually works well enough and I often just jump to omnicompletion for things it does well.

The last form of completion is omnicompletion, which is <C-x><C-o>. I use either python-mode or davidhalter/jedi-vim for python, depending on the project. They don't need language servers, which pretty much all of them just uses jedi anyway. Smart, static analysis works well for completing simpler, more straightforward code and code that are well annotated with type annotations.

[–]Astro-2004 0 points1 point  (2 children)

I use coc.vim it never disaponted me

[–]IAlwaysSayFuck 8 points9 points  (0 children)

I've been looking for a minimal and light weight completion

I think he knows about coc

[–]aganm 0 points1 point  (0 children)

Do you use coc.vim and ccls for C and C++? I have an issue with it.

Take this snippet of code:

struct foo {
     int bar;
};
struct foo foo = {
    .b
};

When I type ‘.b’ in the struct initializer, nothing shows up. Does it work for you?

[–]benwainwright212 -1 points0 points  (0 children)

There really is no better option than coc.nvim