2

I'm working with Vim 7.4 on Mac OS.

I have installed OmniCppComplete plugin and tried to autocomplete c++. Of course I have installed the ctags.

Here is my .vimrc:
enter image description here

Now I have a simple project, which has only one class Test and one member function func() in the Test. Then I execute the command below under the directory of my project:
ctags -R --c++-kinds=+p --fields=+iaS --extra=+q --language-force=c++ .

In the main, I did as below:

#include <iostream>
int main(void) {
    Test t;
    t.| // func( popup automatically
    std::| // ERROR
}

The member function can popup correctly but std:: can't -- Omni completion (^O^N^P) Pattern not found.

It doesn't seem that c++ standard library can be found correctly.

I also found another similar question:
vim omnicppcomplete pattern not found

I also tried to add tags in vim:

:set tags+=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1/

But it still doesn't work.

jww
  • 97,681
  • 90
  • 411
  • 885
Yves
  • 11,597
  • 17
  • 83
  • 180
  • Perhaps you should run ctags for system headers also (not just add path to tags variable within Vim). – Evgeny Panasyuk Oct 16 '16 at 15:00
  • @EvgenyPanasyuk It works! But I can only get something like `std::bind`, things like `std::cout` still doesn't work. – Yves Oct 16 '16 at 15:22
  • This is not answer to your question, but perhaps you could try [YouCompleteMe](https://valloric.github.io/YouCompleteMe/) - it provides exact C++ completion based on Clang. – Evgeny Panasyuk Oct 16 '16 at 15:59
  • @EvgenyPanasyuk OK thanks. I ll try. – Yves Oct 16 '16 at 17:10

0 Answers0