最近我照着https://www.zhihu.com/questio...上的教程安装YCM(You complete me)这个vim上的自动补全插件。我将下载来的ycm的已编译包放在:
D:\packs\YouCompleteMe
把配置的python脚本放在:
C:\.ycm_extra_conf.py
我的vimrc片段是这样的:
"-----------------------ycm(You complete me)
"这里的YCM是知乎上打包发的已编译版本
set runtimepath+=D:\packs\YouCompleteMe
let g:ycm_global_ycm_extra_conf = 'C:\.ycm_extra_conf.py'
let g:ycm_confirm_extra_conf = 0
let Python27="C:\Python27"
let $PYTHONPATH=Python27."DLLs;".Python27."Lib;".Python27."Lib/lib-tk;".Python27."Lib/plat-win;".Python27."Lib/site-packages"
我的py脚本是这样的(部分):
import os
import ycm_core
#get到环境变量
devcpppath=os.environ["devcpppath"]
# These are the compilation flags that will be used in case there's no
# compilation database set (by default, one is not set).
# CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR.
flags = [
'-Wall',
'-Wextra',
'-Werror',
'-fexceptions',
'-DNDEBUG',
# THIS IS IMPORTANT! Without a "-std=<something>" flag, clang won't know which
# language to use when compiling headers. So it will guess. Badly. So C++
# headers will be compiled as C headers. You don't want that so ALWAYS specify
# a "-std=<something>".
# For a C project, you would set this to something like 'c99' instead of
# 'c++11'.
'-std=c++11',
# ...and the same thing goes for the magic -x option which specifies the
# language that the files to be compiled are written in. This is mostly
# relevant for c++ headers.
# For a C project, you would set this to 'c' instead of 'c++'.
'-x',
'c++',
'-isystem',
'/usr/include',
'-isystem',
'/usr/local/include',
'-isystem',
'/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1',
'-isystem',
'/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include',
'-isystem',
devcpppath+'/MinGW64/include',
'-isystem',
devcpppath+'/MinGW64/x86_64-w64-mingw32/include',
'-isystem',
devcpppath+'/MinGW64/lib/gcc/x86_64-w64-mingw3/4.8.1/include',
'-isystem',
devcpppath+'/MinGW64/lib/gcc/x86_64-w64-mingw32/4.8.1/include/c++',
]
我是用devc++编程的OI选手,devcpppath是devc++的安装路径的环境变量。我使用它自带的MinGW。
然而,打开vim后显示:
查询百度和查询google均无果,有人碰到与我相同的问题吗?希望有人来帮忙!!
呵呵,调了4天最终放弃gvim,改用qt去了。此问题终结~