〖Linux〗(2013.08.02)VIM74b+YouCompleteMe,VIM代码编辑器补全能手
2024-10-19 11:41:05
1. 编译和安装vim74b(参考:http://t.cn/zQa8R7h )
sudo apt-get install -y hgsvn libncurses5-dev libgnome2-dev libgnomeui-dev libgtk2.0-dev libatk1.0-dev libbonoboui2-dev libcairo2-dev libx11-dev libxpm-dev libxt-dev python-dev ruby-dev mercurial cscope exuberant-ctagssudo apt-get remove vim vim-runtime gvim #这一步可以不做
cd ~
hg clone https://code.google.com/p/vim/
cd vim
./configure --with-features=huge \
--enable-rubyinterp \
--enable-pythoninterp \
--enable-perlinterp \
--enable-gui=gtk2 --enable-cscope --prefix=/usr
make VIMRUNTIMEDIR=/usr/share/vim/vim73
sudo make install
sudo update-alternatives --install /usr/bin/editor editor /usr/bin/vim
sudo update-alternatives --set editor /usr/bin/vim
sudo update-alternatives --install /usr/bin/vi vi /usr/bin/vim
sudo update-alternatives --set vi /usr/bin/vim
2. 编译Clang3_3(重点,参考:http://t.cn/zjD1V4d)
sudo apt-get install -y g++ subversion cmake
cd ~
mkdir Clang && cd Clang
svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
cd llvm/tools
svn co http://llvm.org/svn/llvm-project/cfe/trunk clang
cd ../../
mkdir build
cd build
../llvm/configure --prefix=/usr/clang_3_3 --enable-optimized --enable-targets=host
make -j
sudo make install
export PATH=/usr/clang_3_3/bin:$PATH #这一句最好写到~/.bashrc内
# 至参考链接后边编译libcxx神马的,就与这里无关了(不过推荐编译和使用一下,尤其是试试它出错的时候,比gcc的提示好多了)
3. 编译和安装、使用YouCompleteMe(https://github.com/Valloric/YouCompleteMe)
>> ----a. 安装管理插件的VIM插件(vunble)
git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
>> ----b. 下载YouCompleteMe至本地
git clone https://github.com/Valloric/YouCompleteMe.git ~/.vim/bundle/YouCompleteMe
>> ----c. 配置vunble并安装YounCompleteMe
vim ~/.vimrc,往里边添加以下这段内容(示例):
""""""""""""""""""""""""""""""
" Vunble
""""""""""""""""""""""""""""""
filetype off " required!
set rtp+=~/.vim/bundle/vundle/
call vundle#rc() " let Vundle manage Vundle
Bundle 'gmarik/vundle' " vim-scripts repos
Bundle 'Valloric/YouCompleteMe' filetype plugin indent on " required!
在VIM中输入 :BundleInstall,在弹出的界面中使用jk上下移动,定位至Bundle 'Valloric/YouCompleteMe',回车即可完成安装
>> ----d. 手动编译YouCompleteMe所依赖的ycm_core.so(这一部分需要前边提示到的Clang)
cd ~
mkdir ycm_build
cd ycm_build
cmake -G "Unix Makefiles" . ~/.vim/bundle/YouCompleteMe/cpp
cmake -G "Unix Makefiles" -DPATH_TO_LLVM_ROOT=/usr/clang_3_3/ . ~/.vim/bundle/YouCompleteMe/cpp
make ycm_core
cp /usr/clang_3_3/lib/libclang.so ~/.vim/bundle/YouCompleteMe/python/libclang.so #这一步是为了使用新的libcang.so
>> ----e. 配置补全,在vimrc中加入
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" YouCompleteMe
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:ycm_global_ycm_extra_conf='~/.vim/bundle/YouCompleteMe/cpp/ycm/.ycm_extra_conf.py'
提示:一些比较大的项目,它索引结构体成员,索引类成员等会比较慢,会显示:No completions found; errors in the file?[just wait a moment, all are perfect! ;-) ]
最新文章
- HTML5-列表的使用
- ural 1144. The Emperor's Riddle
- JVM 参数翻译汉化解释
- Unity3d 音效模块相关
- 【转】MySQL的安装与配置
- NOI2010能量采集(数论)
- Sql Server 2008开发版(Developer Edition)过期升级企业版(Enterprise Edition)失败后安装学习版(Express Edition)
- Josephus问题的不同实现方法与总结
- invalid receiver type
- HUST 1600 Lucky Numbers
- 详解卷积神经网络(CNN)在语音识别中的应用
- 最长绝对文件路径——算法面试刷题1(google),字符串处理,使用tree遍历dfs类似思路
- 13行代码实现:Python实时视频采集(附源码)
- Docker实现运行tomcat并部署项目war包,并实现挂载目录
- [HNOI/AHOI2018]道路
- QLineSeries QChartView 生成折线
- 安装 Scala
- numpy基础入门
- UVA-810 A Dicey Problem (BFS)
- python全栈开发_day16_包