更新你的vim

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 \
  2.     libgtk2.0-dev libatk1.0-dev libbonoboui2-dev \
  3.     libcairo2-dev libx11-dev libxpm-dev libxt-dev python-dev \
  4.     ruby-dev git

    For Fedora 20, that would be the following:
    sudo yum install -y ruby ruby-devel lua lua-devel luajit \
  5.     luajit-devel ctags git python python-devel \
  6.     python3 python3-devel tcl-devel \
  7.     perl perl-devel perl-ExtUtils-ParseXS \
  8.     perl-ExtUtils-XSpp perl-ExtUtils-CBuilder \
  9.     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
  10. sudo ln -s /usr/bin/xsubpp /usr/share/perl5/ExtUtils/xsubpp
  11. 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
  12. Once everything is installed, getting the source is easy. If you’re not using vim 7.4, make sure to set the VIMRUNTIMEDIR variable correctly below (for instance, with vim 7.4a, use /usr/share/vim/vim74a):
    cd ~
  13. git clone https://github.com/vim/vim.git
  14. cd vim
  15. ./configure –with-features=huge \
  16.             –enable-multibyte \
  17.             –enable-rubyinterp \
  18.             –enable-pythoninterp \
  19.             –with-python-config-dir=/usr/lib/python2.7/config \
  20.             –enable-perlinterp \
  21.             –enable-luainterp \
  22.             –enable-gui=gtk2 –enable-cscope –prefix=/usr
  23. make VIMRUNTIMEDIR=/usr/share/vim/vim74
  24. sudo make install

    If you want to be able to easily uninstall the package use
    checkinstall instead of sudo make install
    sudo apt-get install checkinstall
  25. cd vim
  26. sudo checkinstall

    Set vim as your default editor with
    update-alternatives.
    sudo update-alternatives –install /usr/bin/editor editor /usr/bin/vim 1
  27. sudo update-alternatives –set editor /usr/bin/vim
  28. sudo update-alternatives –install /usr/bin/vi vi /usr/bin/vim 1
  29. sudo update-alternatives –set vi /usr/bin/vim
  30. 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
    You may need to add
    –with-python-config-dir=/usr/lib/python2.7/config-x86_64-linux-gnu/ to the configure call.
    These
    configure and make calls assume a Debian-like distro where Vim’s runtime files directory is placed in /usr/share/vim/vim74/, 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).

發表迴響

你的電子郵件位址並不會被公開。