3
votes

I am setting up YouCompleteMe for C++ but when I open a .cpp file I get the error NoExtraConfDetected: No .ycm_extra_conf.py file detected

The .vimrc file looks like this:

set nocompatible " be iMproved, required filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')

" let Vundle manage Vundle, required

Plugin 'VundleVim/Vundle.vim'

Plugin 'rdnetto/YCM-Generator'

Plugin 'Valloric/YouCompleteMe'
let g:ycm_global_ycm_extra_conf = '$USER/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'

" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required

I thought that this line:

let g:ycm_global_ycm_extra_conf = '$USER/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'

would take care of the error.

I followed the path and .ycm_extra_conf.py is there.

Do I have let g:ycm_global_ycm_extra_conf = '$USER/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py' placed wrong in the .vimrc file?

1

1 Answers

1
votes

Can't explain it, but the vimrc does not like $USER and you need the full path there a la $HOME. Try this:

let g:ycm_global_ycm_extra_conf = '/home/YOUR_USER/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'