VIM YouCompleteMe错误- NoExtraConfDetected: 未检测到.ycm_extra_conf.py文件

5

我正在为C ++设置YouCompleteMe,但是当我打开.cpp文件时,出现错误NoExtraConfDetected:未检测到.ycm_extra_conf.py文件

.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在那里。

我在.vimrc文件中是否将let g:ycm_global_ycm_extra_conf = '$USER/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'放错了位置?

1个回答

3

无法解释原因,但是vimrc不喜欢$USER,您需要使用完整路径,例如$HOME。请尝试以下方法:

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


我曾经遇到过完全相同的问题,而这个方法解决了它。起初它并没有对我起作用,但后来我意识到我不小心添加了两行设置此变量的代码(可能是从复制粘贴一些设置时出现的)。 - dekuShrub

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接