ubuntu 下VIM安装YourCompleteMe(中间问题已解决)
来源:互联网 发布:wap手机彩票源码 编辑:程序博客网 时间:2024/05/21 09:40
我是在一个全新的ubuntu12.04的虚拟机虚拟机中安装的
要安装YouCompleteMe ,vim须支持python。看是否支持,可以在vim中:version 查看, 如果python前有+号,就是支持,减号就是不支持。
如果不支持,需要以编译安装方式重新安装vim。
编译配置选项:
./configure --with-features=huge --enable-pythoninterp --enable-python3interp --enable-luainterp --enable-multibyte --enable-sniff --enable-fontset
如果编译的时候添加了支持Python选项,但是vim的version依然不支持Python,那么
apt-get install python-dev
./configure --enable-pythoninterp=yes --with-python-config-dir=/usr/lib/python2.7/config
这里后面的Python的地址一定要指定好
在我的机器上装有python2.7.5 和 python3.3, 但加了enable-python3interp参数依然没有支持py3,不知何故,先不管,YouCompleteMe 只要求有py2.6以上。
先安装git再安装vundle插件
apt-get install git
git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
在.vimrc中配置
set nocompatible " be iMproved, requiredfiletype off " required" set the runtime path to include Vundle and initializeset rtp+=~/.vim/bundle/vundle/call vundle#rc()" alternatively, pass a path where Vundle should install plugins"let path = '~/some/path/here'"call vundle#rc(path)" let Vundle manage Vundle, requiredPlugin 'gmarik/vundle'" The following are examples of different formats supported." Keep Plugin commands between here and filetype plugin indent on." scripts on GitHub reposPlugin 'tpope/vim-fugitive'Plugin 'Lokaltog/vim-easymotion'Plugin 'tpope/vim-rails.git'" 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/'}" scripts from http://vim-scripts.org/vim/scripts.htmlPlugin 'L9'Plugin 'FuzzyFinder'" scripts not on GitHubPlugin 'git://git.wincent.com/command-t.git'" git repos on your local machine (i.e. when working on your own plugin)Plugin 'file:///home/gmarik/path/to/plugin'" ...filetype plugin indent on " requiredBundle 'Valloric/YouCompleteMe'
保存退出,打开vim,输入 :BundleInstall 进行自动安装
进程如下,+号表示已经安装,>表示正在安装。
. Plugin
'gmarik/vundle'
|~
+ Plugin
'tpope/vim-fugitive'
|~
+ Plugin
'Lokaltog/vim-easymotion'
|~
+ Plugin
'tpope/vim-rails.git'
|~
+ Plugin
'rstacruz/sparkup'
|~
+ Plugin
'L9'
|~
+ Plugin
'FuzzyFinder'
|~
> Plugin 'git:
//git.wincent.com/command-|~
t.git' |~
Plugin 'file:
///home/gmarik/path/to/pl|~
ugin' |~
Plugin
'Valloric/YouCompleteMe'
|~
Helptags
结束时有个错误,这是正常的,因为ycm需要手工编译出库文件
Done! With errors; press l to view log
ycm_client_support.[so|pyd|dll] and ycm_core.[so|pyd|dll] not detected; you need
to compile YCM before using it. Read the docs!
到 .vim/bundle/YouCompleteMe 下跑
先安装cmake
apt-get install cmake
./install.sh --clang-completer
参数是为了支持c/c++ 的补全。
安装完成后进行一些简单的配置就可以使用。
YouCompleteMe 的补全配置文件在/bundle/YouCompleteMe/cpp/ycm/.ycm_extra_conf.py,这是个隐藏文件。
默认会使用这个文件,也可以把这个文件copy到工程的根目录中作修改,打开工程文件时会优先使用当前目录下的配置文件。
如果找不到,会根据配置中的ycm_global_ycm_extra_conf 进行查找。
在.vimrc 中添加
let mapleader = "," " 这个leader就映射为逗号“,”
let g:ycm_global_ycm_extra_conf = '~/.vim/bundle/YouCompleteMe/cpp/ycm/.ycm_extra_conf.py' “配置默认的ycm_extra_conf.py
nnoremap <leader>jd :YcmCompleter GoToDefinitionElseDeclaration<CR> “按,jd 会跳转到定义
let g:ycm_confirm_extra_conf=0 “打开vim时不再询问是否加载ycm_extra_conf.py配置
let g:ycm_collect_identifiers_from_tag_files = 1 "使用ctags生成的tags文件
- ubuntu 下VIM安装YourCompleteMe(中间问题已解决)
- 阶乘 计算中间结果引出的问题(已解决)
- 解决Ubuntu 终端vim安装问题-
- ubuntu下ltib安装问题(解决)
- Ubuntu下安装vim的问题和vim的设置
- ubuntu下使用github安装R Packages[已解决]
- ubuntu 下安装vim
- Ubuntu下安装VIM
- 解决ubuntu下网络已断开的问题
- 解决ubuntu下网络已断开的问题
- 【已解决】Ubuntu下git clone 无法连接问题
- 解决Ubuntu环境下vim和QT中文输入问题
- ubuntu下解决vim中文乱码的问题
- ubuntu下chsh命令无法改变默认shell的问题(已解决)
- Ubuntu下MySQL Query Browser无法登陆??HELP!(问题已解决)
- Ubuntu 下安装 vim 时出现无法安装的问题
- (已解决)Android studio安装在Ubuntu时显示no jdk found问题
- 解决linux(Ubuntu)下Pydev无法安装的问题
- 关于conversion to dalvik format failed with error
- Http与HTTP隧道技术
- poj slim span
- ios7毛玻璃效果实现
- Ubuntu下Android Studio设置CheckStyle
- ubuntu 下VIM安装YourCompleteMe(中间问题已解决)
- MySQL禁止反向解析客户端IP(skip-name-resolve)
- 简单的实现涂鸦功能
- findbugs 出错类型及对应解释
- 怎么让tabbarviewcontroller的多个item在一开始的时候就能加载出item的标题和图标
- “未定义的标识符:SurfFeatureDetector”问题解决办法
- 互联网-产品-产品经理奇闻
- 设置linux服务器定时与时间服务器同步
- hibernate 之session 事务管理