Vim中YouCompleteMe插件安装

背景

YouCompleteMe需要使用GCC进行编译,然而Centos 6.7默认的GCC版本太低,所以需要使用devtools-2,用来安装多个版本GCC手动编译安装GCC的坑简直不要太多(类似于rvm)。

升级GCC版本

wget http://people.centos.org/tru/devtools-2/devtools-2.repo -P /etc/yum.repos.d
yum install -y devtoolset-2-gcc devtoolset-2-binutils devtoolset-2-gcc-gfortran devtoolset-2-gcc-c++
scl enable devtoolset-2 bash

OK,现在查看GCC版本信息如下【默认是4.4.7】:

gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/opt/rh/devtoolset-2/root/usr/libexec/gcc/x86_64-redhat-linux/4.8.2/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/opt/rh/devtoolset-2/root/usr --mandir=/opt/rh/devtoolset-2/root/usr/share/man --infodir=/opt/rh/devtoolset-2/root/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --enable-languages=c,c++,fortran,lto --enable-plugin --with-linker-hash-style=gnu --enable-initfini-array --disable-libgcj --with-isl=/dev/shm/home/centos/rpm/BUILD/gcc-4.8.2-20140120/obj-x86_64-redhat-linux/isl-install --with-cloog=/dev/shm/home/centos/rpm/BUILD/gcc-4.8.2-20140120/obj-x86_64-redhat-linux/cloog-install --with-mpc=/dev/shm/home/centos/rpm/BUILD/gcc-4.8.2-20140120/obj-x86_64-redhat-linux/mpc-install --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.2 20140120 (Red Hat 4.8.2-15) (GCC)

下载YouCompleteMe插件

在~/.vimrc中增加一行 Plugin 'Valloric/YouCompleteMe' ,保存后执行命令PluginInstall

编译YouCompleteMe

执行下面命令

cd ~/.vim/bundle/YouCompleteMe && ./install.py

OK,现在YouCompleteMe插件可以正常工作了。

注意事项

  • 因为我的Centos安装了python 2.7(千万不要删除python2.6,因为yum绑定了python2.6),所以无法确定默认的python 2.6能否正确执行上述步骤,如遇到错误,可以安装一个2.7的python。
  • 安装了python 2.7后,如果yum无法使用了,可以编辑/usr/bin/yum,将/usr/bin/python替换为/usr/bin/python2.6

原文链接: https://www.cnblogs.com/zhangyanpei/p/6277079.html

欢迎关注

微信关注下方公众号,第一时间获取干货硬货;公众号内回复【pdf】免费获取数百本计算机经典书籍

    Vim中YouCompleteMe插件安装

原创文章受到原创版权保护。转载请注明出处:https://www.ccppcoding.com/archives/247557

非原创文章文中已经注明原地址,如有侵权,联系删除

关注公众号【高性能架构探索】,第一时间获取最新文章

转载文章受原作者版权保护。转载请注明原作者出处!

(0)
上一篇 2023年2月14日 上午2:20
下一篇 2023年2月14日 上午2:20

相关推荐