Reputation: 169
After following some tutorials i tried to use exuberant ctags to autocomplete e.g. openGL functions. I used the command
ctags -R --languages=C,C++ --c++-kinds=+p --fields=+iaS --extra=+q ./
in the directory where the freeglut.h, glew.h etc resides. Then copying this to a directory pointed by in the .vimrc file (with 'set tags+=./myTag/tags' in my .vimrc) When I try to autocomplete some glut functions i dont get the funciton parameters listed, only the function itself gets completed, but without the parameters.
On the other hand, when Im applying the ctags command above to a .cpp file in the same directory where my main file resides it autocompletes with the function parameters. Im probably missing some essential information here.
Upvotes: -1
Views: 6017
Reputation: 1
In your .vimrc file, before adding the tag files, add the directory. So if you added the tage in $HOME/.vim/tags directory you need to add the following line set tags=~/.vim/tags
The section (in your .vimrc) referred to OmniCppComplete may be something like this:
" configure tags - add additional tags here or comment out not-used ones
" Setting the directory...
set tags=~/.vim/tags
" Adding the tag files
set tags+=~/.vim/tags/cpp
set tags+=~/.vim/tags/gl
set tags+=~/.vim/tags/sdl
set tags+=~/.vim/tags/qt4
" set tags+=$HOME/.vim/tags/standard
" build tags of your own project with Ctrl-F12
map <C-F12> :!ctags -R --sort=yes --c++-kinds=+p --fields=+iaS --extra=+q .<CR>
" OmniCppComplete
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
Upvotes: 0
Reputation: 10747
Firstly, I'm tired of managing ctags by hand, and I wrote plugin Indexer for that. It provides painless automatic tags generation and keeps tags up-to-date. For detailed information, see the article: Vim: convenient code navigation for your projects, which explains the usage of Indexer + Vimprj thoroughly.
And secondly, for code autocompletion, I suggest you to use clang_complete. It provides real, perfect C/C++/Objective-C completion from true compiler, not ugly method by tags.
Upvotes: 2