I've been trying for hours to get the YouCompleteMe plugin for vim to recognize my exuberant ctags. Everything else in YouCompleteMe appears to be working, like autocompleting functions from headers and such. I really want it to default to tag files. Below I've listed my .vimrc
a test tags file which is located at ~/.vim/tags/
This is my testtags
file
!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
!_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/
!_TAG_PROGRAM_NAME Exuberant Ctags //
!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/
!_TAG_PROGRAM_VERSION 5.9~svn20110310 //
myfunc test.h /^void myfunc(int a, int b);$/;" p language:C++
The testtags
file was generated with the command ctags -R --sort=1 --fields=+l --c++-kinds=+p -f testtags test.h
and my .vimrc
file here
syntax on
filetype off
set runtimepath+=~/.vim/bundle/vundle/
call vundle#rc()
Bundle 'gmarik/vundle'
Bundle 'Valloric/YouCompleteMe'
let g:ycm_collect_identifiers_from_tags_files = 1
set tags+=~/.vim/tags/testtags
filetype plugin indent on
The output of entering the vim command :echo tagfiles()
is ['/home/jodag/.vim/tags/testtags']
and the command :set filetype?
is filetype=cpp
. This means that YCM is finding the tag files and recognizing that I'm currently editing a c++ source file but it won't show the myfunc
completion when it press Ctrl+Space. Any help in figuring out why this is happening would be greatly appreciated!
So I figured out the solution after posting on the YCM issue tracker. Apparently the tags file is only read when ctrl+space
isn't pressed.