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

  1. First, install all the prerequisite libraries, including Git. For a Debian-like Linux distribution like Ubuntu, that would be the following:

    sudo apt-get 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 lua5.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.)

    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-get remove vim vim-runtime gvim

    On Ubuntu 12.04.2 you probably have to remove these packages as well:

    sudo apt-get 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 14.04 (Trusty) 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, it will give you an error YouCompleteMe unavailable: requires Vim compiled with Python (2.6+ or 3.3+) support.

    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 \
    --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/vim80

    On Ubuntu 16.04, Python support was not working due to enabling both Python2 and Python3. Read answer by chirinosky for workaround.

    In practice, Python2 and Python3 are not working at the same time on Ubuntu 14.04.5 LTS. Choosing one of them is OK.

    If you want to be able to easily uninstall vim use checkinstall.

    sudo apt-get 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/bin/vim 1
    sudo update-alternatives --set editor /usr/bin/vim
    sudo update-alternatives --install /usr/bin/vi vi /usr/bin/vim 1
    sudo update-alternatives --set vi /usr/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.

Building Vim from source(转)的更多相关文章

  1. Building QGIS from source - step by step(随笔3)

    依赖包安装 在编译QGIS前分别需要利用cygwin和OSGeo4W 安装网站上的依赖库.分别需要安装的依赖库可以参考官网,此外对应版本的ygwin和OSGeo4W 也可以在网站上找到下载链接. ht ...

  2. Building QGIS from source - step by step(随笔2)

    QT安装 在Windows上安装QGIS,首先需要安装VS,VS的版本根据需要的版本下载,注意QGIS版本与VS版本对应.另外QT下载安装也需要与VS版本的安装对应.本机系统装的VS10,对应QT版本 ...

  3. Building QGIS from source - step by step (开发文档翻译1)

    1. 简介 原文网址:http://htmlpreview.github.io/?https://raw.github.com/qgis/QGIS/master/doc/INSTALL.html 本文 ...

  4. Increasing heap size while building the android source code on Ubuntu 15.10

    http://stackoverflow.com/questions/34940793/increasing-heap-size-while-building-the-android-source-c ...

  5. Vim安装记录

    Vim安装记录 参考链接 安装命令 1. 安装依赖库 2. 下载最新vim源码 3. 删除旧版vim 4. 配置configure.编译.安装 5. 设置vim为默认编辑器 6. 必要的配置 Vim安 ...

  6. 如何将vim打造成Linux下的source insight

    编写者:龙诗科 邮箱:longshike2010@163.com 2016-01-06 众所周知,windows下的source insight是阅读项目代码的神器,其神奇之处在于可以根据当前鼠标所指 ...

  7. 源码安装Vim并配置YCM自动补全插件

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

  8. 跟我一起学习VIM

    跟我一起学习VIM - The Life Changing Editor   前两天同事让我在小组内部分享一下VIM,于是我花了一点时间写了个简短的教程.虽然准备有限,但分享过程中大家大多带着一种惊叹 ...

  9. vim快捷键整理(转载)

    一.移动光标 1.左移h.右移l.下移j.上移k2.向下翻页ctrl + f,向上翻页ctrl + b3.向下翻半页ctrl + d,向上翻半页ctrl + u4.移动到行尾$,移动到行首0(数字), ...

随机推荐

  1. CXF浅析

    CXF 框架支撑环境    CXF 框架是一种基于 Servlet 技术的 SOA 应用开发框架,要正常运行基于 CXF 应用框架开发的企业应用,除了 CXF 框架本身之外,还需要 JDK 和 Ser ...

  2. 设计模式之State模式

    State模式定义: 允许一个对象在状态改变是,改变它的行为.看起来对象似乎修改了它的类. 模式理解(个人): State模式主要解决的事在开发中时常遇到的根据不同状态需要进行不同的处理操作的问题,而 ...

  3. 数据库SQL归纳(三)

    数据查询功能 单表查询 选择若干列 1. 指定列 SELECT 列名称 FROM 表名称 2. 全部列 SELECT * FROM 表名称 3. 经过计算的列 SELECT Sname, 2019-S ...

  4. [JSOI2017]原力(分块+map(hash))

    题目描述 一个原力网络可以看成是一个可能存在重边但没有自环的无向图.每条边有一种属性和一个权值.属性可能是R.G.B三种当中的一种,代表这条边上 原力的类型.权值是一个正整数,代表这条边上的原力强度. ...

  5. Codeforces Round #450 (Div. 2) ABCD

    这次还是能看的0 0,没出现一题掉分情况. QAQ前两次掉分还被hack了0 0,两行清泪. A. Find Extra One   You have n distinct points on a p ...

  6. 【Trie】【kd-tree】计蒜客17122 2017 ACM-ICPC 亚洲区(西安赛区)网络赛 I. Barty's Computer

    题意:2种操作:①往集合里添加一个串 ②给你四个小串a b c d,问你集合里有几个串S满足S=a+S1+b+c+S2+d的形式.S1 S2可以为空,并且a+S1+b=c+S2+d. 就搞四颗Trie ...

  7. File I/O知识点

    问题1:File类的作用? 解答:File 类用于访问文件或目录的属性.File类位于java.io包中. 问题2:流?及流的分类? 解答:流是指一连串流动的字符,是以先进先出的方式发送信息的通道.程 ...

  8. [转] Hibernate与 MyBatis的比较

    hibernateHibernateibatisIBATISMyBatismybatis 目录(?)[-] 第一章     Hibernate与MyBatis 1 Hibernate 简介 2 MyB ...

  9. Codeforces Beta Round #1 C. Ancient Berland Circus 计算几何

    C. Ancient Berland Circus 题目连接: http://www.codeforces.com/contest/1/problem/C Description Nowadays a ...

  10. OpenVPN记住账号密码自动连接

    说明:在增加了证书+账号密码之后,安全性确实提高了,但是面临的问题也有,每次重启时必须输入账号密码才能连接,这也造成了无人值守的问题. 解决: 1.在Client的client.ovpn末尾添加一行a ...