芊慕纹绣减脂瘦身刘咏 發表於 2017-3-12 20:44:22

CentOS安装YCM的方法

<p>1、安装vundle&nbsp;</p>
<div class="jb51code">
<pre class="brush:bash;">git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim</pre>
</div>
<p>2、配置.vimrc</p>
<div class="jb51code">
<pre class="brush:bash;">set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'tpope/vim-fugitive'
call vundle#end()   
Bundle 'Valloric/YouCompleteMe'
filetype plugin indent on</pre>
</div>
<p>3、打开vim运行</p>
<div class="jb51code">
<pre class="brush:bash;">:BundleInstall</pre>
</div>
<p>4、安装必要工具</p>
<p>1、yum install gcc gcc-c++ make automake python-devel <br />2、安装CMake </p>
<div class="jb51code">
<pre class="brush:bash;">wget http://www.cmake.org/cmake/resources/software.html
tar -zxv -f cmake-*.*.*.*.tar.gz
cd cmake-*.*.*.*.tar.gz
./bootstrap
gmake
gmake install</pre>
</div>
<p>5、安装clang+llvm(这里用已经编译好的)</p>
<div class="jb51code">
<pre class="brush:bash;">1、wget http://llvm.org/releases/3.5.1/clang+llvm-3.5.1-x86_64-fedora20.tar.xz
xz -d clang+llvm-3.5.1-x86_64-fedora20.tar.xz
tar xvf clang+llvm-3.5.1-x86_64-fedora20.tar
cd clang+llvm-3.5.1-x86_64-fedora20
注:也可用tar xvf clang+llvm-3.5.1-x86_64-fedora20.tar.xz解压

2、在/etc/profile这个档案最尾端添加以下两行代码:

PATH=/usr/local/cmake/bin:/usr/clang_3_3/bin:$PATH
export PATH

3、执行更新变量:source /etc/profile</pre>
</div>
<p>6、进入YCM目录,运行</p>
<div class="jb51code">
<pre class="brush:bash;">./install.sh &ndash;clang-completer</pre>
</div>
<p>7、对~/.vimrc做配置</p>
<div class="jb51code">
<pre class="brush:bash;">let g:ycm_global_ycm_extra_conf = '~/.vim/bundle/YouCompleteMe/third_party/y   cmd/cpp/ycm/.ycm_extra_conf.py'
let g:ycm_confirm_extra_conf = 0

let g:ycm_semantic_triggers = {
\   'c' : ['-&gt;', '    ', '.', ' ', '(', '[', '&amp;'],
\   'cpp,objcpp' : ['-&gt;', '.', ' ', '(', '[', '&amp;', '::'],
\   'perl' : ['-&gt;', '::', ' '],
\   'php' : ['-&gt;', '::', '.'],
\   'cs,java,javascript,d,vim,python,perl6,scala,vb,elixir,go' : ['.'],
\   'ruby' : ['.', '::'],
\   'lua' : ['.', ':']
\ }</pre>
</div>
頁: [1]
查看完整版本: CentOS安装YCM的方法