Skip to content

Instantly share code, notes, and snippets.

@uasi
Created November 30, 2010 16:46
Show Gist options
  • Star 63 You must be signed in to star a gist
  • Fork 44 You must be signed in to fork a gist
  • Save uasi/721952 to your computer and use it in GitHub Desktop.
Save uasi/721952 to your computer and use it in GitHub Desktop.
Vim formula for Homebrew (EDIT: recent versions of official Homebrew distribution includes one)
require 'formula'
class Vim < Formula
homepage 'http://www.vim.org/'
url 'ftp://ftp.vim.org/pub/vim/unix/vim-7.3.tar.bz2'
head 'https://vim.googlecode.com/hg/'
sha256 '5c5d5d6e07f1bbc49b6fe3906ff8a7e39b049928b68195b38e3e3d347100221d'
version '7.3.682'
def features; %w(tiny small normal big huge) end
def interp; %w(lua mzscheme perl python python3 tcl ruby) end
def options
[
["--with-features=TYPE", "tiny, small, normal, big or huge (default: normal)"],
["--enable-interp=NAME,...", "lua, mzscheme, perl, python, python3, tcl and/or ruby"]
]
end
def patches
patch_level = version.to_s.split('.').last.to_i
{'p0' => (1..patch_level).map { |i| 'ftp://ftp.vim.org/pub/vim/patches/7.3/7.3.%03d' % i }}
end
def install
def opt_val(opt)
opt.sub(/.*?=(.*)$/, "\\1") rescue nil
end
opts = []
feature = opt_val(ARGV.find {|s| s =~ /^--with-features=/ }) || "normal"
# For compatibility and convenience {{{
feature_shorthand = features.find {|f| ARGV.include? "--#{f}" }
feature = feature_shorthand if feature_shorthand
# }}}
opts << "--with-features=#{feature}"
interps = opt_val(ARGV.find {|s| s =~ /^--enable-interp=/ }) || ""
interps = interps.split(/,/)
# For compatibility and convenience {{{
interp.each do |i|
if ARGV.include? "--#{i}"
interps << i
end
end
# }}}
interps.uniq!
interps.each do |i|
opts << "--enable-#{i}interp=yes"
opts << "--with-lua-prefix=/usr/local" if i == "lua"
end
system "./configure",
"--disable-gui",
"--without-x",
"--disable-gpm",
"--disable-nls",
"--with-tlib=ncurses",
"--enable-multibyte",
"--prefix=#{prefix}",
"--mandir=#{man}",
*opts
system "make install"
end
end
@1stevengrant
Copy link

I got the error:
/usr/bin/patch: **** Can't open patch file 065-homebrew.diff : No such file or directory
Error: Failure while executing: /usr/bin/patch -f -p0 -i 065-homebrew.diff

@evidens
Copy link

evidens commented Apr 16, 2012

I made a slight modification to the fork by telemachus to make using the homebrew python easy https://gist.github.com/2402135

when you use --use-brew-python flag it will add the option "--with-python-config-dir=/usr/local/lib/python2.7/config"

@just3ws
Copy link

just3ws commented Apr 20, 2012

This is just for my understanding. Why not just use MacVim? I run MacVim on OS X in my terminal with a simple alias, but also get the option to run it as a full windowed app.

in my .bashrc

alias vim="mvim -v"
alias vi="mvim -v"

Is there something I'm missing about MacVim vs Vim?

Thanks.

Copy link

ghost commented Apr 20, 2012

Vim is updated more often than MacVim from my understanding at least.

@ijt
Copy link

ijt commented Apr 20, 2012 via email

@morygonzalez
Copy link

@uasi ここの version 、一旦 to_s しないとエラー出るようになってるっぽいですよ。

patch_level = version.split('.').last.to_i

@diogeneshamilton
Copy link

latest version of brew does not allow split directly, use to_s like in this: https://gist.github.com/3423922

@Enrico68
Copy link

I have problem installing vim with anaconda Python. All plugin with Python code are not working. Is there a way to circumvent this problem ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment