Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim: How to set up an efficient autocomplete configuration?

Tags:

I've been using Vim for a while now and love it, but one thing I've noticed when I use other editors is that I've never really got autocomplete working with much efficiency. I have supertab & snipmate working, I have tags for whatever language I'm using set up, but somehow it seems a little too cumbersome to use all that much, and apart from long method names I typically just avoid autocomplete.

Does anyone have fast, comprehensive autocomplete funcitonality set up in vim? Specifically:

  • At the moment, I hit "tab" to autocomplete class/method/variable names & generate snippets, but Ctrl+X+O for inbuilt langauge commands. I'd rather press tab for everything.

  • The ordering doesn't seem to be too intelligent. Very common stuff is often hidden in the middle of a bunch of rarely-used commands.

  • I've set up autocomplpop to show potential autocompletes as I'm typing, but I have to hit tab twice to accept the first entry. One much rather single-tab it.

So, any tips on setting up an efficient, comprehensive autocomplete configuration in vim? I know this question is a little vague - but if anyone has an overview of how they autocomplete well, and/or a link to a guide, it would be much appreciated.

like image 445
PlankTon Avatar asked Dec 08 '10 11:12

PlankTon


People also ask

Does Vim support code completion?

VIM is a well-known source code editor for programmers. Automatic code completion and syntax highlighting is supported by fglcomp and fglform compilers, when using VIM. Important: In order to use Genero code completion with VIM, you need at least VIM version 7 with the Omni Completion feature.

Can you get Intellisense in Vim?

The auto-completion system (Intellisense) in VSCode is arguably its best feature. Lucky for us, it's been ported over to Vim!


2 Answers

Just thought I'd come back and mention that I finally found something I like: A customised version of NeoComplCache. Nice auto popup, everything integrated pleasantly into 'tab', and with a bit of customisation plays nice with snippets.

http://www.vim.org/scripts/script.php?script_id=2620

like image 68
PlankTon Avatar answered Sep 22 '22 01:09

PlankTon


This is very dependant on your working domain. Vim is a text editor with the ability to interface with intelligent text-aware mechanisms.

If you are using java there is eclim, which is the eclipse backend together with a vim plugin for the frontend.


For C or C++ there is the plugin OmniCppComplete
It works by scanning the headers in the paths you have set up in vim (see :h path), and works very well imo.

If you have to press Ctrl-X_Ctrl-O for omnicompleteion, then your supertab config seems a bit broken. It should try omni or filename completion first, and then fall back to word completion.

like image 33
ggVGc Avatar answered Sep 23 '22 01:09

ggVGc