Make YouCompeleteMe work with vim

本文介绍如何为Vim编辑器配置YouCompleteMe插件,包括安装带有Python支持的Vim版本及构建YouCompleteMe的过程。适用于openSUSE系统的详细步骤。

YouCompeleteMe is very powerful vim plugin for compeletion.

Unfortunately, the default vim you installed probably don't support YouCompeleteMe. After adding config entries in .vimrc for YCM, you may get the warning below when open vim:

youcompleteme unavailable: requires vim compiled with python (2.6+ or 3.3+) support

You need to build vim with python support. Follow this doc: Building Vim from source I'm using openSUSE, but this doc doesn't list zypper command to install prerequisites.

  • install packages
zypper install libncurses5 libgnome-devel libgnomeui-devel libgtk-2_0-0 libatk-1_0-0 \  libbonoboui-devel libcairo2 libX11-devel libXpm-devel libXt-devel python \  
python-devel python3 python3-devel ruby-devel perl perl-devel lua51 lua51-devel git 
  • clone vim
git clone https://github.com/vim/vim.git
  • config, build and install vim
cd vim 
./configure --with-features=huge \
            --enable-multibyte \
            --enable-rubyinterp \
            --enable-pythoninterp \
            --with-python-config-dir=/usr/lib/python2.7/config \
            --enable-perlinterp \
            --enable-luainterp \
            --enable-gui=gtk2 --enable-cscope --prefix=/usr

make VIMRUNTIMEDIR=/usr/share/vim/vim74
sudo make install

sudo update-alternatives --install /usr/bin/editor editor /usr/bin/vim 1
sudo update-alternatives --set editor /usr/bin/vim
sudo update-alternatives --install /usr/bin/vi vi /usr/bin/vim 1
sudo update-alternatives --set vi /usr/bin/vim

  • build YCM
cd .vim/bundle/YouCompleteMe
zypper install gcc-c++ cmake
./install.py

Open vim and edit something to test it. Enjoy!

转载于:https://my.oschina.net/u/2475751/blog/1518581

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值