Skip to content

Instantly share code, notes, and snippets.

@ypandit
Forked from mgrouchy/vim.rb
Created June 15, 2012 01:53
Show Gist options
  • Save ypandit/2934192 to your computer and use it in GitHub Desktop.
Save ypandit/2934192 to your computer and use it in GitHub Desktop.
Vim formula for Homebrew
require 'formula'
class Vim < Formula
homepage 'http://www.vim.org/'
url 'https://vim.googlecode.com/hg/', :revision => '57e8b75298d6'
version '7.3.712'
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: huge)"],
["--enable-interp=NAME,...", "lua, mzscheme, perl, python, python3, tcl and/or ruby (default:python,ruby)"]
]
end
def install
def opt_val(opt)
opt.sub(/.*?=(.*)$/, "\\1") rescue nil
end
opts = []
feature = opt_val(ARGV.find {|s| s =~ /^--with-features=/ }) || "huge"
# 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=/ }) || "perl,python,ruby"
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-nls",
"--disable-gpm",
"--disable-netbeans",
"--disable-arabic",
"--disable-farsi",
"--disable-cscope",
"--disable-emacs_tags",
"--disable-keymap",
"--disable-langmap",
"--enable-feature=browse",
"--with-tlib=ncurses",
"--enable-multibyte",
"--prefix=#{prefix}",
"--mandir=#{man}",
*opts
system "make install"
end
end
@ypandit
Copy link
Author

ypandit commented Nov 10, 2012

brew install https://raw.github.com/gist/2934192/e6542b1c69cf566d87804214431d64d1e2ffad7c/vim.rb

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