Building Vim from source(转)

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.

时间: 2024-10-25 10:48:19

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

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

依赖包安装 在编译QGIS前分别需要利用cygwin和OSGeo4W 安装网站上的依赖库.分别需要安装的依赖库可以参考官网,此外对应版本的ygwin和OSGeo4W 也可以在网站上找到下载链接. https://htmlpreview.github.io/?https://raw.github.com/qgis/QGIS/master/doc/INSTALL.html#toc13 需要注意的是OSGeo4W 在安装grass依赖时出现了zlib1.dll等部分dll丢失的情况,楼主上网找了一下没

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-code-on-ubuntu-15-10 export JACK_SERVER_VM_ARGUMENTS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4096m" out/host/linux-x86/bin/jack-admin ki

Ubuntu14.04下编译安装Vim74+Vim-gdb

一.准备工作 1.下载Vim74和适合7.4版本的vim-gdb: (1)vim7-4.tar.bz2 (2)vimgdb-for-7.4 2.卸载已存在的vim以及相关组件 如果已经通过软件中心安装了vim,则需要将其卸载 sudo apt-get remove vim vim-runtime gvim 可能还需要移除以下的包: sudo apt-get remove vim-tiny vim-common vim-gui-common 3.安装依赖环境 手动编译安装Vim74,首先先安装编译

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

编写者:龙诗科 邮箱:[email protected] 2016-01-06 众所周知,windows下的source insight是阅读项目代码的神器,其神奇之处在于可以根据当前鼠标所指的函数名或者变量,来进行全局搜索该函数或变量的定义,而且还会显 示出哪些文件中同样含有该函数定义,另外可以显示当前文件中的变量和函数列表.因此特别适合在windows下用source insight 来进行大项目代码阅读和管理.但是Linux下不能 安装source insight,而vim和Emacs是l

Vim 快捷键整理

一.移动光标 1.左移h.右移l.下移j.上移k 2.向下翻页ctrl + f,向上翻页ctrl + b 3.向下翻半页ctrl + d,向上翻半页ctrl + u 4.移动到行尾$,移动到行首0(数字),移动到行首第一个字符处^ 5.移动光标到下一个句子 ),移动光标到上一个句子( 6.移动到段首{,移动到段尾} 7.移动到下一个词w,移动到上一个词b 8.移动到文档开始gg,移动到文档结束G 9.移动到匹配的{}.().[]处% 10.跳到第n行 ngg 或 nG 或 :n 11.移动光标到

vim快捷键整理(转载)

一.移动光标 1.左移h.右移l.下移j.上移k2.向下翻页ctrl + f,向上翻页ctrl + b3.向下翻半页ctrl + d,向上翻半页ctrl + u4.移动到行尾$,移动到行首0(数字),移动到行首第一个字符处^5.移动光标到下一个句子 ),移动光标到上一个句子(6.移动到段首{,移动到段尾}7.移动到下一个词w,移动到上一个词b8.移动到文档开始gg,移动到文档结束G9.移动到匹配的{}.().[]处%10.跳到第n行 ngg 或 nG 或 :n11.移动光标到屏幕顶端H,移动到屏

wenbao与vim

vim是非常有逼格的编辑器,里面有非常强悍的功能....学习中!!!!!!!!!!!! 常用指令 @清空整个文件: (esc)首先执行  gg 这里是跳至文件首行 再执行:dG 这样就清空了整个文件! 还有一种方法就要退出VIM,然后使用echo >> file ,这样也能快速清空文件内容,当然你也可以删除了这个文件再新建一个就是了. @复制整个文件(前提是配置好) (esc)ggVG全选命令,y复制,(p是粘贴) @撤销操作 (esc)u @删除 (esc) x(删除当前光标下的字符) dw

vim多窗口, 常用命令集

1.打开多个窗口 打开多个窗口的命令以下几个: 横向切割窗口 :new+窗口名(保存后就是文件名) :split+窗口名,也可以简写为:sp+窗口名 纵向切割窗口名 :vsplit+窗口名,也可以简写为:vsp+窗口名 vim -o file1 file2 ...  #水平打开多窗口, vim -O file1 file2 ...  #垂直打开多窗口, vim -d file1 file2 ...  #垂直打开多窗口,并且进行比较 vimdiff file1 file2 ..  #等同于上一句

跟我一起学习VIM - vim插件合集

2016-06-14 15:04 13333人阅读 评论(0) 收藏 举报 分类: Linux(104)  目录(?)[+]  前两天同事让我在小组内部分享一下VIM,于是我花了一点时间写了个简短的教程.虽然准备有限,但分享过程中大家大多带着一种惊叹的表情,原来编辑器可以这样强大,这算是对我多年来使用VIM的最大鼓舞吧.所以分享结束之后,将这篇简短教程整理一下作为我2014年的第一篇Blog. 目录写在前面:Life Changing Editor什么是VIM为什么选VIM为什么选其它为什么犹豫