我正在为 C++ 设置 YouCompleteMe,但是当我打开 .cpp 文件时,出现错误 NoExtraConfDetected: No .ycm_extra_conf.py file detector
.vimrc 文件如下所示:
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
我认为这一行:
let g:ycm_global_ycm_extra_conf = '$USER/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'
会处理这个错误。
我沿着路径走,.ycm_extra_conf.py就在那里。
我是否将let g:ycm_global_ycm_extra_conf = '$USER/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'在 .vimrc 文件中放置错误?
小智 3
无法解释它,但 vimrc 不喜欢 $USER 并且您需要 $HOME 的完整路径。尝试这个:
让 g:ycm_global_ycm_extra_conf = '/home/YOUR_USER/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'