Install vim74 from source

Vim 7.4 released!

What are you waiting for?


install vim7.4 for mac

HomeBrew has update the vim formula to the latest 7.4! woo!

See vim.rb

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
require 'formula'
class Vim < Formula
homepage 'http://www.vim.org/'
# Get the base 7.4 tarball from Vim.org. But once patches start again, go
# back to tracking Debian unstable here:
# http://ftp.de.debian.org/debian/pool/main/v/vim/
url 'http://ftp.vim.org/pub/vim/unix/vim-7.4.tar.bz2'
sha1 '601abf7cc2b5ab186f40d8790e542f86afca86b7'
head 'https://vim.googlecode.com/hg/'
# We only have special support for finding depends_on :python, but not yet for
# :ruby, :perl etc., so we use the standard environment that leaves the
# PATH as the user has set it right now.
env :std
LANGUAGES = %w(lua mzscheme perl python tcl ruby)
DEFAULT_LANGUAGES = %w(ruby python)
option "override-system-vi", "Override system vi"
option "disable-nls", "Build vim without National Language Support (translated messages, keymaps)"
LANGUAGES.each do |language|
option "with-#{language}", "Build vim with #{language} support"
option "without-#{language}", "Build vim without #{language} support"
end
depends_on :hg => :build if build.head?
depends_on :python => :recommended
def install
ENV['LUA_PREFIX'] = HOMEBREW_PREFIX
language_opts = LANGUAGES.map do |language|
if DEFAULT_LANGUAGES.include? language and !build.include? "without-#{language}"
"--enable-#{language}interp"
elsif build.include? "with-#{language}"
"--enable-#{language}interp"
end
end.compact
opts = language_opts
opts << "--disable-nls" if build.include? "disable-nls"
# Avoid that vim always links System's Python even if configure tells us
# it has found a brewed Python. Verify with `otool -L`.
if python && python.brewed?
ENV.prepend 'LDFLAGS', "-F#{python.framework}"
end
# XXX: Please do not submit a pull request that hardcodes the path
# to ruby: vim can be compiled against 1.8.x or 1.9.3-p385 and up.
# If you have problems with vim because of ruby, ensure a compatible
# version is first in your PATH when building vim.
# We specify HOMEBREW_PREFIX as the prefix to make vim look in the
# the right place (HOMEBREW_PREFIX/share/vim/{vimrc,vimfiles}) for
# system vimscript files. We specify the normal installation prefix
# when calling "make install".
system "./configure", "--prefix=#{HOMEBREW_PREFIX}",
"--mandir=#{man}",
"--enable-gui=no",
"--without-x",
"--enable-multibyte",
"--with-tlib=ncurses",
"--enable-cscope",
"--with-features=huge",
"--with-compiledby=Homebrew",
*opts
system "make"
# If stripping the binaries is not enabled, vim will segfault with
# statically-linked interpreters like ruby
# http://code.google.com/p/vim/issues/detail?id=114&thanks=114&ts=1361483471
system "make", "install", "prefix=#{prefix}", "STRIP=/usr/bin/true"
ln_s bin+'vim', bin+'vi' if build.include? 'override-system-vi'
end
end

Just use

1
brew install vim --with-python --with-ruby --with-perl --with-lua --with-tcl

Wait or take a coffee break! And enjoy vim 7.4.

By the way, when you want to update brew but failed because of some formula you’ve editted which results in merge…

1
2
3
cd `brew --prefix`
git checkout .
brew update

install vim7.4 for ubuntu

A little complex but very easy!

  • install the dependencies
1
2
3
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 ruby-dev libperl-dev

Note. I’m not very clear about the dependencies but python-dev ruby-dev libperl-dev are for python, ruby, perl interp.
For me, that’s enough.

  • remove the old vim
1
sudo apt-get remove vim vim-runtime gvim vim-tiny vim-common vim-gui-common
  • download the source and compile to install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
wget http://ftp.vim.org/pub/vim/unix/vim-7.4.tar.bz2
tar xvf vim-7.4.tar.bz2
cd vim
./configure \
--prefix=/usr \
--enable-perlinterp=dynamic \
--enable-pythoninterp \
--enable-rubyinterp \
--enable-luainterp=dynamic \
--enable-cscope \
--enable-gui=auto \
--enable-gtk2-check \
--enable-gnome-check \
--enable-multibyte \
--enable-fontset \
--with-features=huge \
--with-x \
--with-ruby-command=/usr/bin/ruby \
--with-compiledby="Lihuazhang <lihuazhang@hotmail.com>" \
--with-python-config-dir=/usr/lib/python2.7/config-x86_64-linux-gnu \
# --with-python3-config-dir=/usr/lib/python3.3/config-3.3m-x86_64-linux-gnu

Wait for a seconds and sudo make install once the configure is compelted.

  • set your vim as your default editor
1
2
3
4
5
# The prefix=/usr should be specified!
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

Then done. Enjoy vim7.4.


I have personally tested both installation.

If you have any question, please ping me. Or

Refer:

  1. http://vim.wikia.com/wiki/Building_Vim
  2. https://github.com/Valloric/YouCompleteMe/wiki/Building-Vim-from-source
文章目录
  1. 1. Vim 7.4 released!
    1. 1.1. install vim7.4 for mac
    2. 1.2. install vim7.4 for ubuntu
|