1

I just installed omnicppcomplete and it is "kindof" working.

The behaviour is realy strange, Omnicppcomplete is working for some files but not for others.

E.g.: If I open file1.cpp omnicppcomplete is working if I push . However, if I open file2.cpp omnicppcomplete is not working anymore and I get the error: -- Omni complete (^O^N^P) Pattern not found.

Here is my complete .vimrc:

" -------------------------------- PLUGINS ----------------------------"
"############### ctags

" build tags of your own project
map <C-c> :!ctags -R --sort=yes --c++-kinds=+p --fields=+iaS --extra=+q .<CR>

"############### OmniCppComplete
au BufNewFile,BufRead,BufEnter *.cpp,*.hpp set omnifunc=omni#cpp#complete#Main
filetype on

" configure tags - add additional tags here or comment out not-used ones
set tags+=~/.vim/tags/cpp
set tags+=~/.vim/tags/cuda

let OmniCpp_NamespaceSearch = 1
let OmniCpp_GlobalScopeSearch = 1
let OmniCpp_ShowAccess = 1
let OmniCpp_ShowPrototypeInAbbr = 1 " show function parameters
let OmniCpp_MayCompleteDot = 1 " autocomplete after .
let OmniCpp_MayCompleteArrow = 1 " autocomplete after ->
let OmniCpp_MayCompleteScope = 1 " autocomplete after ::
let OmniCpp_DefaultNamespaces = ["std", "_GLIBCXX_STD"]
" automatically open and close the popup menu / preview window
au CursorMovedI,InsertLeave * if pumvisible() == 0|silent! pclose|endif
set completeopt=menuone,menu,longest,preview

Furthermore, I'm using MacVim 7.3.

Any help is much appreciated.

user1829358
  • 1,041
  • 2
  • 9
  • 19

1 Answers1

0

First thing: I would recommend you not to deal with ctags manually, but use plugin Indexer instead, it will do all the work automatically. I used Indexer and omnicppcomplete for a long time, in most cases omnicppcomplete works acceptably.

For detailed information, see my article: Vim: convenient code navigation for your projects, which explains the usage of Indexer + Vimprj thoroughly.

Second thing: Omnicppcomplete works acceptably, but not perfect. For C/C++ autocompletion I would recommend you not to use omnicppcomplete, but use clang_complete plugin instead. It is really powerful, completion is done not by ugly tags method, but with real C/C++/Objective-C compiler (which is clang).

Dmitry Frank
  • 10,417
  • 10
  • 64
  • 114
  • `:s/use plugin/use my plugin` ;-) – romainl Nov 16 '12 at 12:42
  • @romainl, true, but does it change anything in essence? =) – Dmitry Frank Nov 16 '12 at 13:15
  • Not at all, especially given the usefulness of your plugin. It's just good form to disclose that kind of thing, I think. But I don't really care, hence the smiley. – romainl Nov 16 '12 at 13:56
  • @dimtry: is clang_complete working with all kind of libraries as well? So after including the header, e.g.: cuda_runtime.h? – user1829358 Nov 16 '12 at 17:15
  • @user1829358, `clang_complete` just uses output of `clang`, which is real powerful compiler. Of course, `clang` handles correctly header includes, and everything what compiler should handle. – Dmitry Frank Nov 16 '12 at 17:46