要安装YouCompleteMe ,vim须支持python。看是否支持,可以在vim中:version 查看, 如果python前有+号,就是支持,减号就是不支持。

如果不支持,需要以编译安装方式重新安装vim。

编译配置选项:

./configure --with-features=huge --enable-pythoninterp --enable-python3interp --enable-luainterp --enable-multibyte --enable-sniff --enable-fontset

在我的机器上装有python2.7.5 和 python3.3, 但加了enable-python3interp参数依然没有支持py3,不知何故,先不管,YouCompleteMe 只要求有py2.6以上。

安装vundle插件

git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle

在.vimrc中配置

set nocompatible              " be iMproved, required
filetype off " required " set the runtime path to include Vundle and initialize
set 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, required
Plugin 'gmarik/vundle' " The following are examples of different formats supported.
" Keep Plugin commands between here and filetype plugin indent on.
" scripts on GitHub repos
Plugin '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.html
Plugin 'L9'
Plugin 'FuzzyFinder'
" scripts not on GitHub
Plugin '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 " required
Bundle '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 下跑

./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文件

给vim安装YouCompleteMe的更多相关文章

  1. vim安装YouCompleteMe 插件

    要安装YouCompleteMe ,vim须支持python.看是否支持,可以在vim中:version 查看, 如果python前有+号,就是支持,减号就是不支持. 如果不支持,需要以编译安装方式重 ...

  2. Vim 安装 YouCompleteMe

    Vim 下的自动补全,最好的工具莫过于 YouCompleteMe,官方文档在这里 http://valloric.github.io/YouCompleteMe/ 安装稍显复杂,以下记录我的过程. ...

  3. UBuntu14.04 --vim安装YouCompleteMe插件

    说明 我电脑的系统参数(用 uname -a命令查看)如下: Linux avyn-Lenovo --generic #-Ubuntu SMP Tue Mar :: UTC i686 i686 i68 ...

  4. Vim+Vundle+YouCompleteMe 安装

    这段时间在Centos 7上开发c++程序,想为vim安装YouCompleteMe插件,参照几个博客无果,果断上官网找解决方案.功夫不负苦心人,终于搞定. 学习东西还是要多上官网. 下面送上本次的收 ...

  5. vim 安装

    Ubuntu 16.04 下 Vim安装及配置 默认已经安装了VIM-tiny linuxidc@linuxidc:~$ locate vi | grep 'vi$' |xargs ls -al lr ...

  6. Ubuntu16.04安装vim插件YouCompleteMe

    原文 1 下载 git clone --recursive git://github.com/Valloric/YouCompleteMe 如果执行该命令没报错, 就ok了. 但是中途有可能会断掉, ...

  7. 解决安装YouCompleteMe与Vim版本不兼容问题

    用vim 7.4.4版本装YouCompleMe的时候提示这样的信息: YouCompleteMe unavailable: requires Vim 7.4.1578+.明明版本比它要求的还高,居然 ...

  8. Vim中YouCompleteMe插件安装

    背景 YouCompleteMe需要使用GCC进行编译,然而Centos 6.7默认的GCC版本太低,所以需要使用devtools-2,用来安装多个版本GCC手动编译安装GCC的坑简直不要太多(类似于 ...

  9. 【转】ubuntu 12.04 下 Vim 插件 YouCompleteMe 的安装

    原文网址:http://www.cnblogs.com/jostree/p/4137402.html 作者:jostree 转载请注明出处 http://www.cnblogs.com/jostree ...

随机推荐

  1. JSP 问题总结

    <input type="button" value="返回" onclick="javascript:window.location.href ...

  2. 第129天:node.js安装方法

    node.js安装方法 第一步:双击node.js安装包开始安装,注意64位和32位,按照自己的进行安装 第二步:在安装过程中一直选择next,在选择安装目录时,大多数默认安装在C盘,我安装在了D盘, ...

  3. 【.Net】net 反射15分钟速成

    概述 什么是反射 Reflection,中文翻译为反射.        这是.Net中获取运行时类型信息的方式,.Net的应用程序由几个部分:‘程序集(Assembly)’.‘模块(Module)’. ...

  4. 转---Android Audio System 之一:AudioTrack如何与AudioFlinger交换音频数据

    引子 Android Framework的音频子系统中,每一个音频流对应着一个AudioTrack类的一个实例,每个AudioTrack会在创建时注册到 AudioFlinger中,由AudioFli ...

  5. 【明哥报错簿】之 mybatis异常invalid comparison: java.util.Date and java.lang.String

    背景:数据库为postgresql,表字段属性为timestamp格式 原因是mybatis 3.3.0中对于时间参数进行比较时的一个bug. 如果拿传入的时间类型参数与空字符串''进行对比判断则会引 ...

  6. VLC for Android 编译过程

    首先,给一个VLC的官网链接:VLC-AndroidCompile 上面有编译所需要安装的插件,环境变量的配置等等信息:虽然是英语,但也挺好理解,这里就不再详述:此文主要记录我在编译的过程中遇到的一些 ...

  7. CVE-2017-16995 Ubuntu16.04本地提权漏洞复现

    0x01 前言 该漏洞由Google project zero发现.据悉,该漏洞存在于带有 eBPF bpf(2)系统(CONFIG_BPF_SYSCALL)编译支持的Linux内核中,是一个内存任意 ...

  8. 使用expect实现自动登录的脚本

    使用expect实现自动登录的脚本,网上有很多,可是都没有一个明白的说明,初学者一般都是照抄.收藏.可是为什么要这么写却不知其然.本文用一个最短的例子说明脚本的原理. 脚本代码如下: ######## ...

  9. bzoj4753: [Jsoi2016]最佳团体(分数规划+树形依赖背包)

    菜菜推荐的“水题”虐了我一天T T...(菜菜好强强qwq~ 显然是个分数规划题,二分答案算出p[i]-mid*s[i]之后在树上跑依赖背包,选k个最大值如果>0说明还有更优解. 第一次接触树形 ...

  10. 在Mac上安装mysql数据库

    安装 登录MySQL网站 用dmg的方式安装.Download MySQL Community Server 或者常规方式,打开官网 : http://www.mysql.com/downloads/ ...