Skip to content
Permalink
master
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time
class Vim < Formula
desc "Vi 'workalike' with many additional features"
homepage "https://www.vim.org/"
# vim should only be updated every 50 releases on multiples of 50
url "https://github.com/vim/vim/archive/v8.2.3650.tar.gz"
sha256 "a2ea5becb025c9bb7a3c64ec757fa6a410261db5c12e12b783b148972c642413"
license "Vim"
head "https://github.com/vim/vim.git", branch: "master"
bottle do
sha256 arm64_monterey: "2cf1bcd1f8a0400f4446c0b861fb715e81a56149ea59763b6e63f415565f643e"
sha256 arm64_big_sur: "599b0ae9a253c93de59308c45d36b97da71299fa29029a4b379f7147bdb741e9"
sha256 monterey: "006dc1d04de197b4065df32482a0ff68b7fc48f8ca197227e07573df40bc1a66"
sha256 big_sur: "567b1ea4b38e67d60bc65981d0c8acfeaaee19656d118daa6d0bc9ee49b2274c"
sha256 catalina: "4213cfb7111c6f99fd8fe027bbffab91f4d633589c9c1eb80f6efa1fc5db77f7"
sha256 x86_64_linux: "95dfcc1bf732e04c6e1d88313802c9115ff0b020627588b97948db1c10e06c6f"
end
depends_on "gettext"
depends_on "lua"
depends_on "ncurses"
depends_on "perl"
depends_on "python@3.9"
depends_on "ruby"
conflicts_with "ex-vi",
because: "vim and ex-vi both install bin/ex and bin/view"
conflicts_with "macvim",
because: "vim and macvim both install vi* binaries"
def install
ENV.prepend_path "PATH", Formula["python@3.9"].opt_libexec/"bin"
# https://github.com/Homebrew/homebrew-core/pull/1046
ENV.delete("SDKROOT")
# vim doesn't require any Python package, unset PYTHONPATH.
ENV.delete("PYTHONPATH")
# 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".
# Homebrew will use the first suitable Perl & Ruby in your PATH if you
# build from source. Please don't attempt to hardcode either.
system "./configure", "--prefix=#{HOMEBREW_PREFIX}",
"--mandir=#{man}",
"--enable-multibyte",
"--with-tlib=ncurses",
"--with-compiledby=Homebrew",
"--enable-cscope",
"--enable-terminal",
"--enable-perlinterp",
"--enable-rubyinterp",
"--enable-python3interp",
"--enable-gui=no",
"--without-x",
"--enable-luainterp",
"--with-lua-prefix=#{Formula["lua"].opt_prefix}"
system "make"
# Parallel install could miss some symlinks
# https://github.com/vim/vim/issues/1031
ENV.deparallelize
# If stripping the binaries is enabled, vim will segfault with
# statically-linked interpreters like ruby
# https://github.com/vim/vim/issues/114
system "make", "install", "prefix=#{prefix}", "STRIP=#{which "true"}"
bin.install_symlink "vim" => "vi"
end
test do
(testpath/"commands.vim").write <<~EOS
:python3 import vim; vim.current.buffer[0] = 'hello python3'
:wq
EOS
system bin/"vim", "-T", "dumb", "-s", "commands.vim", "test.txt"
assert_equal "hello python3", File.read("test.txt").chomp
assert_match "+gettext", shell_output("#{bin}/vim --version")
end
end