Hacker News new | ask | show | jobs
by thristian 5434 days ago
> A word of caution first: there is no perfect symbol-based navigation for programming languages such as C++ or Java in vim, as vim doesn't perform any syntax analysis of the code.

At least for Python, Vim's OmniCompletion does a reasonable job of figuring out function names:

http://vimdoc.sourceforge.net/htmldoc/version7.html#new-omni...

3 comments

For C and C++, clang_complete gives pretty good completion.

https://github.com/Rip-Rip/clang_complete

I like where this is going, but it was a bit unstable for my taste last I tried it. I think it still relies on the file being syntactically correct, which may break your parsing sometimes and is still quite slow with template-heavy code (Boost mostly). Is it still the case?

I'd also like some more build system integration hooks (e.g. provide project-specific include dirs and CXXFLAGS on a per-file basis).

You can provide your own flags to the compiler, in the g:clang_user_options variable. It does still break in uncompilable code but I don't quite see how that's a problem. It forces you to be more disciplined. If you're finding it a bit slow, the help files do explain you how to set up precompiled headers with it. I haven't tried that though, so I can't comment on how much it helps. Personally, the only times a get annoyed with it are when I type 'catch (...', and it thinks I want it's help.
Same thing for php. I really don't want to use Eclipse, but its a pain navigating source code using cscope. For instance, if you are looking for a method definition, it may list hundreds of matches. It has no notion of semantic analysis. It doesn't know what class is calling the particular method and if you're looking for something like $instance->execute, you're screwed.
That's because the whole problem is trivial in Python. What he's talking about is jumping to the correct version of an overloaded function and similar.