Compiling Vim from source is actually not that difficult. Here's what you should do:

1. Install all the prerequisite libraries (including Git)
a. For a Debian-like Linux distribution like Ubuntu, type
sudo apt install libncurses5-dev libgnome2-dev libgnomeui-dev \
libgtk2.0-dev libatk1.0-dev libbonoboui2-dev \
libcairo2-dev libx11-dev libxpm-dev libxt-dev python-dev \
python3-dev ruby-dev lua5.1 liblua5.1-dev libperl-dev git
On Ubuntu 16.04, liblua5.1-dev is the lua dev package name not lua5.1-dev. (If you know what languages you'll be using, feel free to leave out packages you won't need, e.g. Python2 python-dev or Ruby ruby-dev. This principle heavily applies to the whole page.) b. For Fedora 20, that would be the following:
sudo yum install -y ruby ruby-devel lua lua-devel luajit \
luajit-devel ctags git python python-devel \
python3 python3-devel tcl-devel \
perl perl-devel perl-ExtUtils-ParseXS \
perl-ExtUtils-XSpp perl-ExtUtils-CBuilder \
perl-ExtUtils-Embed
This step is needed to rectify an issue with how Fedora 20 installs XSubPP: # symlink xsubpp (perl) from /usr/bin to the perl dir
sudo ln -s /usr/bin/xsubpp /usr/share/perl5/ExtUtils/xsubpp
2. Remove vim if you have it already.
sudo apt remove vim vim-runtime gvim
On Ubuntu 12.04.2 you probably have to remove these packages as well: sudo apt remove vim-tiny vim-common vim-gui-common vim-nox
3. Once everything is installed, getting the source is easy.
Note: If you are using Python, your config directory might have a machine-specific name (e.g. config-3.5m-x86_64-linux-gnu). Check in /usr/lib/python[2/3/3.5] to find yours, and change the python-config-dir and/or python3-config-dir arguments accordingly. Note for Ubuntu users: You can only use Python 2 or Python 3. If you try to compile vim with both python-config-dir and python3-config-dir, YouCompleteMe will give you an error YouCompleteMe unavailable: requires Vim compiled with Python (2.6+ or 3.3+) support, when you start VIM. On Ubuntu 16.04, Python support was not working due to enabling both Python2 and Python3. Read answer by chirinosky for workaround. Add/remove the flags below to fit your setup. For example, you can leave out enable-luainterp if you don't plan on writing any Lua. Also, if you're not using vim 8.0, make sure to set the VIMRUNTIMEDIR variable correctly below (for instance, with vim 8.0a, use /usr/share/vim/vim80a). Keep in mind that some vim installations are located directly inside /usr/share/vim; adjust to fit your system: cd ~
git clone https://github.com/vim/vim.git
cd vim
./configure --with-features=huge \
--enable-multibyte \
--enable-rubyinterp=yes \
--enable-pythoninterp=yes \
--with-python-config-dir=/usr/lib/python2.7/config \ # pay attention here check directory correct
--enable-python3interp=yes \
--with-python3-config-dir=/usr/lib/python3.5/config \
--enable-perlinterp=yes \
--enable-luainterp=yes \
--enable-gui=gtk2 \
--enable-cscope \
--prefix=/usr/local make VIMRUNTIMEDIR=/usr/local/share/vim/vim81
On CentOS7(x86_64), change --with-python-config-dir=/usr/lib/python2.7/config to --with-python-config-dir=/lib64/python2.7/config. If you want to be able to easily uninstall vim use checkinstall. sudo apt install checkinstall
cd ~/vim
sudo checkinstall
Otherwise, you can use make to install. cd ~/vim
sudo make install
Set vim as your default editor with update-alternatives. sudo update-alternatives --install /usr/bin/editor editor /usr/local/bin/vim 1
sudo update-alternatives --set editor /usr/local/bin/vim
sudo update-alternatives --install /usr/bin/vi vi /usr/local/bin/vim 1
sudo update-alternatives --set vi /usr/local/bin/vim
4. Double check that you are in fact running the new Vim binary by looking at
the output of vim --version. If you don't get gvim working (on ubuntu 12.04.1 LTS), try changing --enable-gui=gtk2 to --enable-gui=gnome2 If you have problems, double check that you configured using the correct Python config directory, as noted at the beginning of Step 3. These configure and make calls assume a Debian-like distro where Vim's runtime files directory is placed in /usr/share/vim/vim80/, which is not Vim's default. Same thing goes for --prefix=/usr in the configure call. Those values may need to be different with a Linux distro that is not based on Debian. In such a case, try to remove the --prefix variable in the configure call and the VIMRUNTIMEDIR in the make call (in other words, go with the defaults). If you get stuck, here's some other useful information on building Vim

  

通过 Vundle 来安装 YCM(官方推荐

git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

  将 Vundle 配置添加到 .vimrc 的头部

set nocompatible              " be iMproved, required
filetype off " required " set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here') " let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim' " All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line

  对于 Vundle 可以根据自己的需要,适当调整添加的插件。

在 vim 的配置文件 ~/.vimrc 中添加一行(在call vundle#begin() 和 call vundle#end() 之间)

call vundle#begin()
. . .
Plugin 'Valloric/YouCompleteMe’
. . .
call vundle#end()

  然后保存运行 vim 命令 :PluginInstall 安装

配置好系统的 Python 环境以及 CMake
以下是针对 Ubuntu 系统的环境配置,这里主要需要给系统安装配置好 cmake 以及 python,具体命令如下: # install CMake
sudo apt-get install build-essential cmake
# install Python
sudo apt-get install python-dev python3-dev
通过 Git Clone 下载 YouCompleteMe
官网文档介绍,YouCompleteMe 是可以通过 Vundle 来安装的,但由于我的网络问题,所以我选择了直接从 GitHub 上下载好文件。方法如下: # make sure in dir ~/.vim/bundle
cd ~/.vim/bundle
# Download by git clone
git clone https://github.com/Valloric/YouCompleteMe.git
安装 YouCompleteMe
接下来,进入最后的步骤,运行 .install.py 脚本安装语言支持。这里为了方便,我们选择安装所有语言支持,如果需要只安装特定的语言支持,可以参考官方文档。 cd ~/.vim/bundle/YouCompleteMe
./install.py --all

  

 

源码安装Vim并配置YCM自动补全插件的更多相关文章

  1. 【转】Vim自动补全插件----YouCompleteMe安装与配置

    原文网址:http://www.cnblogs.com/zhongcq/p/3630047.html 使用Vim编写程序少不了使用自动补全插件,在Linux下有没有类似VS中的Visual Assis ...

  2. Vim自动补全插件----YouCompleteMe安装与配置

    Vim自动补全插件----YouCompleteMe安装与配置 使用Vim编写程序少不了使用自动补全插件,在Linux下有没有类似VS中的Visual Assist X这么方便快捷的补全插件呢?以前用 ...

  3. CentOS7 Vim自动补全插件----YouCompleteMe安装与配置

    最近刚装了新系统CentOS7,想要把编码环境配置一下,使用Vim编写程序少不了使用自动补全插件,我以前用的是neocomplcache+code_complete+omnicppcomplete.但 ...

  4. [转] vim配置python自动补全

    vim python自动补全插件:pydiction 可以实现下面python代码的自动补全: 1.简单python关键词补全 2.python 函数补全带括号 3.python 模块补全 4.pyt ...

  5. VIM自动补全插件 - YouCompleteMe--"大神级vim补全插件"

    VIM自动补全插件 - YouCompleteMe 序言 vim 之所以被称为编辑器之神多半归功于其丰富的可DIY的灵活插件功能,( 例如vim下的这款神级般的代码补全插件YouCompleteMe) ...

  6. Vimer的福音 新时代的Vim C++自动补全插件 clang_complete

    使用vim的各位肯定尝试过各种各样的自动补全插件,比如说大名鼎鼎的 OmniCppComplete .这一类的插件都是对 Ctags 生成的符号表进行字符串匹配来获得可能的补全项.他们在编写 C 代码 ...

  7. 新时代的Vim C++自动补全插件 clang_complete

    Vimer的福音 新时代的Vim C++自动补全插件 clang_complete   使用vim的各位肯定尝试过各种各样的自动补全插件,比如说大名鼎鼎的 OmniCppComplete .这一类的插 ...

  8. vim中自动补全插件snipmate使用

    vim中自动补全插件snipmate使用 1.下载snipMatezip:https://github.com/msanders/snipmate.vim/archive/master.zip 2.解 ...

  9. vim python自动补全插件:pydiction

    vim python自动补全插件:pydiction 可以实现下面python代码的自动补全: 1.简单python关键词补全 2.python 函数补全带括号 3.python 模块补全 4.pyt ...

随机推荐

  1. 用maven在MANIFEST.MF文件中的Class-Path中增加当前目录(.)

    Xml代码 <configuration> <archive> <manifest> <mainClass>com.dongwei.test.Main& ...

  2. feiQ发送信息

    import java.io.IOException; import java.net.DatagramPacket; import java.net.DatagramSocket; import j ...

  3. Mac 屏幕录制Gif 制作 By-胡罗

    一.视频录制 1)使用Mac系统自带的QuickTime进行屏幕录像 手动打开(如下图) 详细 Mac 基础教程:如何使用 Mac 系统原生的屏幕录制功能 相关快捷键 option+command+n ...

  4. Docker-Compose 容器集群的编排

    Docker-Compose 容器集群的编排 1.Docker-Compose 概述 2.Docker Compose 环境安装 Docker-Compose功能:  可以实现单机上的容器集群编排 1 ...

  5. .NET 云原生架构师训练营(权限系统 代码实现 EntityAccess)--学习笔记

    目录 开发任务 代码实现 开发任务 DotNetNB.Security.Core:定义 core,models,Istore:实现 default memory store DotNetNB.Secu ...

  6. 4、前端--浮动、定位、是否脱离文档流、溢出属性、z-index、透明度、JavaScript简介

    浮动 # ps:html代码时没有缩进一说的 全部写在一行也可以 """浮动主要就是用于页面布局的!!!""" # 浮动带来的负面影响 &q ...

  7. 基于Xilinx XCKU115的半高PCIe x8 硬件加速卡

    一.板卡概述 本板卡系我公司自主研发,采用Xilinx公司的XCKU115-3-FLVF1924-E芯片作为主处理器,主要用于FPGA硬件加速.板卡设计满足工业级要求.如下图所示: 二.功能和技术指标 ...

  8. 图的深度遍历(C语言)邻接矩阵表示

    知识讲解: 图的遍历分为两种,深度遍历与广度遍历.这里讨论深度遍历. 以上图为例讨论图(图片来自<算法笔记>)的深度遍历: 设图形的顶点数为n. 先从顶点v0开始,用一个数组vis[n]来 ...

  9. 一个命令让redis服务端所有信息无所遁形~(收藏吃灰系列)

    1.info命令作用 在redis客户端执行INFO 命令以便于计算机解析和人工阅读的简单格式返回有关redis服务端的所有信息和统计数据. 可选参数可用于选择特定的信息部分: Server 服务器基 ...

  10. web安全之快速反弹 POST 请求

    在 CTF Web 的基础题中,经常出现一类题型:在 HTTP 响应头获取了一段有效期很短的 key 值后,需要将经过处理后的 key 值快速 POST 给服务器,若 key 值还在有效期内,则服务器 ...