Ubuntu下安装 YouCompleteMe

来源:互联网 发布:知己知彼软件破解版 编辑:程序博客网 时间:2024/06/06 17:37

需求:vim 版本要高于 7.4.13xx (Ubuntu 16.04 对应的vim集成包可以,而14.04则不行)

安装:

1. 安装 vundle

git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
编辑 ~/.vimrc, 最后加上:

set nocompatible              " be iMproved, requiredfiletype off                  " required" set the runtime path to include Vundle and initializeset rtp+=~/.vim/bundle/Vundle.vimcall vundle#begin()" alternatively, pass a path where Vundle should install plugins"call vundle#begin('~/some/path/here')" let Vundle manage Vundle, requiredPlugin 'VundleVim/Vundle.vim'" plugin on GitHub repoPlugin 'tpope/vim-fugitive'" plugin from http://vim-scripts.org/vim/scripts.html" vim 官方插件配置方法,写入名字就行了Plugin 'L9'" Git plugin not hosted on GitHub" git服务器插件,但不是在GitHub上面Plugin 'git://git.wincent.com/command-t.git'" git repos on your local machine (i.e. when working on your own plugin)" git 仓库在自己的电脑上"Plugin 'file:///home/gmarik/path/to/plugin'" The sparkup vim script is in a subdirectory of this repo called vim." Pass the path to set the runtimepath properly.Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}Bundle 'Valloric/YouCompleteMe'" All of your Plugins must be added before the following linecall vundle#end()            " requiredfiletype plugin indent on    " required" To ignore plugin indent changes, instead use:"filetype plugin on"" Brief help" :PluginList       - lists configured plugins" :PluginInstall    - installs plugins; append `!` to update or just :PluginUpdate" :PluginSearch foo - searches for foo; append `!` to refresh local cache" :PluginClean      - confirms removal of unused plugins; append `!` to auto-approve removal"" see :h vundle for more details or wiki for FAQ

2.保存退出后打开vim,在正常模式下输入:

:BundleInstall
等待插件安装完成

3.而后进行编译安装:

cd ~/.vim/bundle/YouCompleteMe./install.sh --clang-completer

如果不需要c-family的补全,可以去掉--clang-completer。如果需要c#的补全,请加上--omnisharp-completer。

正常来说,YCM会去下载clang的包,如果已经有,也可以用系统--system-libclang。


如果提示错误,则可能是相关软件或开发包没有安装。

需要安装 cmake, python-dev 等,apt-get install,之后重新编译安装即可。


运行会出错误提示:ValueError: Still no compile flags, no completions yet

Solution:在 ~/.vimrc 文件中添加如下行

let g:ycm_global_ycm_extra_conf = '~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'

0 0
原创粉丝点击