2

Recently I have started to switch from IntelliJ stack to Vim as main IDE. Vim with plugins seems awesome to me once you get into it. Sadly during my process to switch from one to another, I realized how much I have been depending on autocomplete.

I found a plugin called YouCompleteMe but it seems not enough since it does not work with frameworks or libraries like Spring or React. I'm also worried about testing libraries.

My question is how you folks handle this kind of situation? Is there another plugin that I couldn't find or it's just to learn to live without autocomplete?

  • 1
    I'm not a big fan of autocomplete as done in IDEs, so take this with a grain of salt. What I use is CTRL+P (and less often CTRL+N), which is language agnostic, and autocompletes purely words (so works for text documents too). I code in C and C++, and set pa=.,..,,../..,../include,../../include,, makes vim find the include files and autocomplete from there too. It's not great to autocomplete very generic methods like get, release, etc, but they tend to be easy to remember anyway. The perk is that it autocompletes from every word, including from comments. Don't know about Java. – Shahbaz May 30 at 1:50
  • 2
    Welcome to Vi and Vim! You should take a look at coc.nvim (despite the nvim in the name, it also works with Vim 8.) It's more modern and easier to use than YCM in my opinion. You can also use external language servers through the LSP (Language Server Protocol), which perhaps is what might help you with better support for Spring and React. The coc.nvim plug-in is able to query external LSPs. Sorry I can't be too specific about how to put this all together, but hopefully the pointers are useful to you! – filbranden May 30 at 6:05
  • 1
    Thank you for your advice and for the warm welcome. I'm already using coc.vim and it looks like that's what I was looking for. Problem solved! – Adrian Asensio Monterde May 30 at 11:04
  • @AdrianAsensioMonterde Feel free to post an answer to your own question! – filbranden May 31 at 4:02
1

After a little research, the solution seems to be in the Coc.nvim plugin. It uses Language Server Protocol (LSP) to get the autocompletion data for a specific language. I've seen that some languages are missing like Gradle or Kotlin, but it could be developed since Coc.nvim offers you the possibility.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.