vim代码补全YouCompleteMe(YCM)在ubuntu下安装过程及出现的问题

####整理:
https://juejin.im/post/5b597a9cf265da0f9402b434
https://blog.csdn.net/u011671986/article/details/70195241
###1. 安装git,cmake:sudo apt-get install git/cmake
###2. 安装Vundle:git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
(~/.vim/bundle/Vundle.vim是保存的路径)
####下载完成后进入到用户目录(命令:cd ~)在**.vimrc文件编辑添加以下配置:(没有.vimrc文件就自己创建)
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin ‘VundleVim/Vundle.vim’
"后面的那一行代码添加到此处
call vundle#end()
filetype plugin indent on
####更多的配置可以查看:https://github.com/VundleVim/Vundle.vim
####启动vim,输入:
:PluginInstall
####注意区分大小写及前面的冒号(大写字母为P和第二个I)
###3. 下载YouCompleteMe:
####先进入bundle目录:
cd ~/.vim/bundle
####再下载:
git clone https://github.com/Valloric/YouCompleteMe.git
####然后进入到YouCompleteMe目录:
cd ~/.vim/bundle/YouCompleteMe
####准备进行编译,编译前输入:
git submodule update --init --recursive
####然后编译YCM需要支持的语言:
######编译支持C族语言的YCM:
./install.py --clang-completer
######编译不支持C族语言的YCM:
./install.py
######编译支持所有语言的YCM:
./install.py --all
####选择编译所有就行了
编译参考:https://github.com/Valloric/YouCompleteMe#ubuntu-linux-x64
###4. 在编译过程中出现的问题:
####- 缺少一些python头文件,输入:
sudo apt-get install python-dev
####- 编译到71%的时候就一直卡住,没有反应,提示:
install pcm stop at 71% CodePoint.cpp.o
####原因是在编译时所需空间不足,解决的办法是添加swap文件:
Linux下创建Swap交换文件
Linux下增加、删除Swap文件
####编译完成后,在
.vimrc**添加:
Plugin ‘VundleVim/YouCompleteMe’
###5. 配置YCM
####编译完成后,打开vim,提示没有ycm_extra_conf.py文件,解决办法:下载.ycm_extra_conf.py
####下载步骤:
#####进入到~/.vim/bundle/YouCompleteMe/cpp:
cd ~/.vim/bundle/YouCompleteMe/cpp
#####如果没有cpp目录,就创建一个:
mkdir cpp
####然后下载.ycm_extra_conf.py(如果链接失效则去https://github.com/Valloric/YouCompleteMe#general-semantic-completion查找):
wget https://github.com/Valloric/YouCompleteMe/blob/master/.ycm_extra_conf.py
####或者新建一个.ycm_extra_conf.py,将内容复制进去:
####需要在.ycm_extra_conf.py文件中添加一些引用(添加到flags下),添加内容:
‘./tests/gmock/include’,
‘-isystem’,
‘/usr/include’,
‘/usr/include/c++/5.4.0’,
‘/usr/include’,
‘/usr/include/x86_64-linux-gnu/c++’,
####最后在.vimrc中配置.ycm_extra_conf.py的路径:
g:ycm_global_ycm_extra_conf=’~/.vim/bundle/YouCompleteMe/cpp/.ycm_extra_conf.py’
####全部完成

你可能感兴趣的:(Linux)