YouCompleteMe

最近用了一段时间VS,感觉用了几年的VIM显得有些单薄,主要是代码提示方面,补全啥的,那么又有人会说那样不好,对你熟悉代码有影响,就像有的人喷Source Insight的理由就是用到最后某个函数在哪个文件当中都不清楚了,与不停地敲对象的结构体内容相比,突然有一种找找舒适的感觉的冲动,还是决定在VIM上动刀子,毕竟EMACS一般不太会有人安装,而VIM一般都会有,而且可以远程SSH操作,有的只有VI,没VIM?好吧,当我没说

以前一直是PC直接安装Linux系统,如今没有windows很多东西还是蛮复杂的,像以前linux下再安装一个windows虚拟机,也不是太方便;这玩意刚已经弄了好久,只不过是在Cygwin上弄的,尽管vim默认会有ctrl-x,ctrl-o这之类的补全,甚至还有ctrl-n这种一大排的,可估计不会有人有兴趣,刚刚盯上了一个新的工具YouCompleteMe

githup链接:https://github.com/Valloric/YouCompleteMe

说实话深深地被主页这张动态图吸引住了!

第一个人说的方法:

git clone –recursive https://github.com/Valloric/YouCompleteMe.git

这样就将YouCompleteMe的整个文件夹都checkout下来了

cmake -G “Unix Makefiles”  -DPATH_TO_LLVM_ROOT=~/hello/YouCompleteMe . ~/.vim/bundle/YouCompleteMe/cpp make ycm_support_libs

这一步安装有很多依赖,~/hello/YouCompleteMe是checkout的文件夹,等我把所有依赖都弄好了,最后一个ycm_support_libs实在不知道是啥玩意

 

第二个人的方法:

git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle

. Plugin 'gmarik/vundle' |~

+ Plugin 'tpope/vim-fugitive' |~

+ Plugin 'Lokaltog/vim-easymotion' |~

+ Plugin 'tpope/vim-rails.git' |~

+ Plugin 'rstacruz/sparkup' |~

+ Plugin 'L9' |~

+ Plugin 'FuzzyFinder' |~

> Plugin 'git://git.wincent.com/command-|~

t.git' |~

Plugin 'file:///home/gmarik/path/to/pl|~

ugin' |~

Plugin 'Valloric/YouCompleteMe' |~

Helptags

+表示已经完成的,>表示正在进行,坑爹Plugin 'FuzzyFinder' |~前面一个感叹号,直接不进行了

 

不清楚是不是Cygwin的问题,这东西必须要vim支持python,只需要输入vim然后:version就可以查看vim支持的所有,前面是+即可

我干脆直接按照脚本要求,将第一种方法已经checkout完的YouCompleteMe直接copy到第二种方法脚本里说的目录.vim/bundle下,直接运行install脚本来安装,按照githup说明,要想生效C,后面要加选项–clang-complete,照做

lihui@LastWish ~/.vim/bundle/YouCompleteMe $ ./install.sh –clang-completer
运行了老半天,最终:

BoostParts/CMakeFiles/BoostParts.dir/build.make:402: recipe for target ‘BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/converter/arg_to_python_base.cpp.o’ failed
make[3]: *** [BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/converter/arg_to_python_base.cpp.o] Error 1
make[3]: *** 正在等待未完成的任务….
[ 12%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/converter/from_python.cpp.o
BoostParts/CMakeFiles/BoostParts.dir/build.make:425: recipe for target ‘BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/converter/builtin_converters.cpp.o’ failed
make[3]: *** [BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/converter/builtin_converters.cpp.o] Error 1
In file included from /usr/include/python2.7/Python.h:58:0,
                 from /home/liang/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/BoostParts/boost/python/detail/wrap_python.hpp:142,
                 from /home/liang/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/BoostParts/boost/python/detail/prefix.hpp:13,
                 from /home/liang/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/BoostParts/boost/python/converter/from_python.hpp:8,
                 from /home/liang/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/BoostParts/libs/python/src/converter/from_python.cpp:6:
/usr/include/python2.7/pyport.h:886:2: 错误:#error “LONG_BIT definition appears wrong for platform (bad gcc/glibc config?).”
#error “LONG_BIT definition appears wrong for platform (bad gcc/glibc config?).”
  ^
BoostParts/CMakeFiles/BoostParts.dir/build.make:448: recipe for target ‘BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/converter/from_python.cpp.o’ failed
make[3]: *** [BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/converter/from_python.cpp.o] Error 1
CMakeFiles/Makefile2:78: recipe for target ‘BoostParts/CMakeFiles/BoostParts.dir/all’ failed
make[2]: *** [BoostParts/CMakeFiles/BoostParts.dir/all] Error 2
CMakeFiles/Makefile2:212: recipe for target ‘ycm/CMakeFiles/ycm_support_libs.dir/rule’ failed
make[1]: *** [ycm/CMakeFiles/ycm_support_libs.dir/rule] Error 2
Makefile:148: recipe for target ‘ycm_support_libs’ failed
make: *** [ycm_support_libs] Error 2

怎么看上去是有关C++支持的时候,某些库存在问题,目前没成功,好事多磨,有人说成功安装需要3个小时,今天就先试下水,等下半夜挂着让他更新试试!

发表回复