vim YouCompleteme安装
步骤一:
vimrc中添加youcompleteme插件
.vimrc中添加
Bundle 'Valloric/YouCompleteMe'
在命令行模式下
:BundleInstall
步骤二:
下载最新版本的libclang
下载地址:http://llvm.org/releases/download.html
Clang for x86_64 Ubuntu 16.04 (.sig)(官方建议)
编译安装ycm_core需要cmake和python-dev支持。
安装cmake,python:
Ubuntu: sudo apt-get install cmake
Ubuntu: sudo apt-get install python-dev python3-dev
编译安装
cd ~
mkdir ycm_build
cd ycm_build
从llvm的官网下载了LLVM+Clang的二进制包
解压到:~/ycm_temp/llvm_root_dir
该目录下有bin, lib, include等文件夹
cmake -G "Unix Makefiles" -DPATH_TO_LLVM_ROOT=~/ycm_temp/llvm_root_dir
. ~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp
至此,makefile已生成。
生成ycm_core
cmake --build . --target ycm_core --config Release
遇到的一些问题:
在vimrc中添加如下内容:
报错提示:编译的版本为python2而使用的是python3,添加下面语句
let g:ycm_server_python_interpreter='/usr/bin/python'
复制.ycm_extra_conf.py 文件
cp ~/.vim/bundle/YouCompleteMe/third_party/ycmd/examples/.ycm_extra_conf.py ~/.vim/
在vimrc中添加如下内容:
let g:ycm_global_ycm_extra_conf='~/.vim/.ycm_extra_conf.py'
sudo apt-get install libpython2.7-dev
shell
#!/bin/bash
# install vim-markdown
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
sudo npm -g install instant-markdown-d
#install YouCompleMe
mkdir ycm_build
mkdir ycm_temp
cd ycm_temp
wget http://releases.llvm.org/4.0.0/clang+llvm-4.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz
tar -Jxvf clang+llvm-4.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz
wget https://cmake.org/files/v3.9/cmake-3.9.0-Linux-x86_64.tar.gz
tar -zxvf cmake-3.9.0-Linux-x86_64.tar.gz
cd cmake-3.9.0-Linux-x86_64
sudo cp -rf ./bin/* /usr/bin/
sudo cp -rf ./share/* /usr/share/
sudo cp -rf ./doc/* /usr/share/doc/
sudo cp -rf ./man/* /usr/share/doc/
sudo apt-get install libpython2.7-dev
cd ../clang+llvm-4.0.0-x86_64-linux-gnu-ubuntu-16.04
cmake -G "Unix Makefiles" -DPATH_TO_LLVM_ROOT=~/vim/ycm_temp/clang+llvm-4.0.0-x86_64-linux-gnu-ubuntu-16.04 . ~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp
cmake --build . --target ycm_core --config Release
cp ~/.vim/bundle/YouCompleteMe/third_party/ycmd/examples/.ycm_extra_conf.py ~/.vim/