views:

2522

answers:

3

In a nutshell, I'm searching for a working autocompletion feature for the Vim editor. I've argued before that Vim completely replaces an IDE under Linux and while that's certainly true, it lacks one important feature: autocompletion.

I know about Ctrl-N, Exuberant Ctags integration, Taglist, cppcomplete and OmniCppComplete. Alas, none of these fits my description of “working autocompletion:”

  • Ctrl-N works nicely (only) when you've forgotton how to spell class, or while. Oh well.
  • Ctags gives you the rudiments but has a lot of drawbacks.
  • Taglist is just a Ctags wrapper and as such, inherits most of its drawbacks (although it works well for listing declarations).
  • cppcomplete simply doesn't work as promised, and I can't figure out what I did wrong, or if it's “working” correctly and the limitations are by design.
  • OmniCppComplete seems to have the same problems as cppcomplete, i.e. auto-completion doesn't work properly. Additionally, the tags file once again needs to be updated manually.

I'm aware of the fact that not even modern, full-blown IDEs offer good C++ code completion. That's why I've accepted Vim's lack in this area until now. But I think a fundamental level of code completion isn't too much to ask, and is in fact required for productive usage. So I'm searching for something that can accomplish at least the following things.

  • Syntax awareness. cppcomplete promises (but doesn't deliver for me), correct, scope-aware auto-completion of the following:

    variableName.abc
    variableName->abc
    typeName::abc
    

    And really, anything else is completely useless.

  • Configurability. I need to specify (easily) where the source files are, and hence where the script gets its auto-completion information from. In fact, I've got a Makefile in my directory which specifies the required include paths. Eclipse can interpret the information found therein, why not a Vim script as well?

  • Up-to-dateness. As soon as I change something in my file, I want the auto-completion to reflect this. I do not want to manually trigger ctags (or something comparable). Also, changes should be incremental, i.e. when I've changed just one file it's completely unacceptable for ctags to re-parse the whole directory tree (which may be huge).

Did I forget anything? Feel free to update.

I'm comfortable with quite a lot of configuration and/or tinkering but I don't want to program a solution from scratch, and I'm not good at debugging Vim scripts.

A final note, I'd really like something similar for Java and C# but I guess that's too much to hope for: ctags only parses code files and both Java and C# have huge, precompiled frameworks that would need to be indexed. Unfortunately, developing .NET without an IDE is even more of a PITA than C++.

+3  A: 

Hi, is what you are looking for something like intellisense?

insevim seems to address the issue.

link to screenshots here

Ric Tokyo
This would be what I'm looking for, yes. Unfortunately, it only runs on Windows (I'm using OS X). Also, the last update seems to have been made around 2003. :-(
Konrad Rudolph
well you can get the source code :) if not that, the only thing I can think of is omnicompletion.. or have a look at this: http://ankitjain.org/blog/2007/06/30/integrating-vim-with-monodevelop/ for .net stuff at least..
Ric Tokyo
Ric, please provide your comment as two separate answers, they're invaluable, and I'd like to honour them properly! That said, MonoDevelop is unusable under OS X as of now, and I'm currently looking into OmniCppComplete.
Konrad Rudolph
Lol this is windows only! :( Why should u want this on windows where u have VS.. I'm looking for a solution on Linux.
Nils
Nils: Not everyone has access to Visual Studio, also alot of people have vi skills which they want to apply in the Windows environment.There was a port to Linux, but its currently down. In any case, what are you trying to achieve? are you sure you dont just need the default auto-complete functions? http://www.linux.org/docs/ldp/howto/C-editing-with-VIM-HOWTO/auto-complete.html
Ric Tokyo
+2  A: 

Hi, as per requested, here is the comment I gave earlier:

have a look at this:

this link should help you if you want to use monodevelop on a MacOSX

Good luck and happy coding.

Ric Tokyo
+2  A: 

I've just found the project Eclim linked in another question. This looks quite promising, at least for Java integration.

Konrad Rudolph