要安装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. Mybatis 中 sql 语句的占位符 #{} 和 ${}

    #{} 表示一个占位符号,通过 #{} 可以实现 preparedStatement 向占位符中设置值,自动进行 java 类型和 jdbc 类型转换.#{} 可以有效防止   sql注入. #{}  ...

  2. 第148天:js+rem动态计算font-size的大小,适配各种手机设备

    需求: 在不同的移动终端设备中实现,UI设计稿的等比例适配. 方案: 布局排版都用rem做单位,然后不同宽度的屏,js动态计算根节点的font-size. 假设设计稿是宽750px来做的,书写css方 ...

  3. IDEA使用switch传入String编译不通过

    今天在使用IDEA的时候,用到switch分支语句,传入String参数的时候一直报错,下面是源码报错截图: 看错误提示并没有提到switch支持String类型,不过ava1.7之后就支持Strin ...

  4. Unity3D for VR 学习(7): 360°全景照片

    在VR应用中,有一个相对简单的虚拟现实体验,那就是360°全景照片浏览器, 他可以使得手机拍照的”全景”照片,  得以”恢复”当时拍照的场景全貌,  这个创意的确比单纯的2d图片更有震撼力一些,故本文 ...

  5. bzoj3251: 树上三角形(思维题)

    神tmWA了8发调了20min才发现输出没回车T T... 首先考虑一段什么样的序列才会是N... 显然最长的形式就是斐波那契,前两数之和等于第三数之和,这样就无法组成三角形并且序列最长.可以发现在i ...

  6. [JOI 2014 Final] IOI 馒头

    link 试题分析 我们发现若是要选馒头的话则应该从馒头售价高的先装. 并且若要选择包装盒时应该选择装x个最小的时候.所以只需要贪心$+$背包即可. #include<iostream> ...

  7. Linux之选取信息命令介绍与应用20170331

    在介绍选取信息命令之前,说一下管道符“|”与tr命令,因为在使用多个命令一起的时候经常用到它. 一.利用Linux所提供的管道符“|”将两个命令隔开,管道符左边命令的输出就会作为管道符右边命令的输入. ...

  8. 《JavaScript高级程序设计(第三版)》-3

    相等操作符 相等和不相等 在转换不同的数据类型时,相等和不想等操作符遵循下面基本规则: 如果有一个操作符数是布尔值,则在比较相等性之前先将其转换为数值——false转换为0,而true转换为1: 如果 ...

  9. Codeforces Round #409 (rated, Div. 2, based on VK Cup 2017 Round 2) A B C D 暴力 水 二分 几何

    A. Vicious Keyboard time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  10. 洛谷P2344 奶牛抗议

    题目背景 Generic Cow Protests, 2011 Feb 题目描述 约翰家的N 头奶牛正在排队游行抗议.一些奶牛情绪激动,约翰测算下来,排在第i 位的奶牛的理智度为Ai,数字可正可负. ...