-
-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Expand file tree
/
Copy pathvim.rb
More file actions
95 lines (85 loc) · 4.04 KB
/
vim.rb
File metadata and controls
95 lines (85 loc) · 4.04 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
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/v9.0.1900.tar.gz"
sha256 "c631c375565fb35c2e37bd0aea6aa79c0b25391ce3e9b093321876fa5dd47f66"
license "Vim"
head "https://github.com/vim/vim.git", branch: "master"
# The Vim repository contains thousands of tags and the `Git` strategy isn't
# ideal in this context. This is an exceptional situation, so this checks the
# first page of tags on GitHub (to minimize data transfer).
livecheck do
url "https://github.com/vim/vim/tags"
regex(%r{href=["']?[^"' >]*?/tag/v?(\d+(?:\.\d+)+)["' >]}i)
strategy :page_match
end
bottle do
sha256 arm64_sonoma: "a18fe6b2e2eb0430f85b64c712acbf104210b8354cd0ac4f799137978e576b33"
sha256 arm64_ventura: "2e39f89e6c7adbf1c852bafc96bc2016c019705ea6a841aa4bba0e316df2bbc3"
sha256 arm64_monterey: "d1d70308dbf5600b26de6dcd97cf0fb5f19029c19b607118b4af8f11add43a58"
sha256 arm64_big_sur: "0f30cd1248dd5b087c352e9eb5ea19a52b72ad63c2a0da821c5a7a955f268d15"
sha256 sonoma: "c71d78e9e57dbbc95076dce65f2bf3b02cd21a5871e3596936342979dfdafc06"
sha256 ventura: "23c7a75d402e3ffb830e7d272d3ec91f3980917769ceb9b4032cb336265fa7b3"
sha256 monterey: "22d700bbd8eadcf270496b3eb98fb97638c930be27bdd2ae454e29ac6059fe84"
sha256 big_sur: "6cbad503034158806227128743d2acc08773c90890cea12efee25c4a53399d02"
sha256 x86_64_linux: "e75d0713849a3ef4004989051d16017b51994239c9e1aef403a82182e8ab216e"
end
depends_on "gettext"
depends_on "libsodium"
depends_on "lua"
depends_on "ncurses"
depends_on "perl"
depends_on "python@3.11"
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.11"].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",
"--disable-gui",
"--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")
assert_match "+sodium", shell_output("#{bin}/vim --version")
end
end