blob: 59edf84799421ea35ffde58b1fb24fdef262951d (
plain) (
blame)
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
|
#!/usr/bin/env bash
set -eo pipefail
DIRS="syntax indent compiler autoload ftplugin ctags after/syntax after/indent after/ftplugin"
# shellcheck disable=SC2034
DIRS_BASIC="syntax compiler indent after/syntax after/indent"
# shellcheck disable=SC2034
DIRS_ALL="syntax indent compiler autoload ftplugin after extras ctags"
# shellcheck disable=SC2034
DIRS_SYNTAX="syntax indent after/syntax after/indent"
# shellcheck disable=SC2034
DIRS_NOAFTER="syntax compiler indent autoload ftplugin"
DIRS_JAVASCRIPT="${DIRS} extras"
read -r -a DIRS_RM <<<"$DIRS_ALL"
OUTPUT=""
output() {
OUTPUT="$OUTPUT$1"
echo -n "$1"
}
download() {
for pack in $1; do
path="$(cut -d ':' -f 2 <<<"$pack")"
dir="tmp/$(cut -d '/' -f 2 <<<"$path")"
repo="$(awk -F\# '{print $1}' <<<"$path")"
branch="$(awk -F\# '{print $2}' <<<"$path")"
rm -rf "$dir"
(mkdir -p "$dir" && curl --silent -fL "https://codeload.github.com/$repo/tar.gz/${branch:-master}" | tar -zx -C "$dir" --strip 1 && printf '.' || echo "Failed to download: $repo") &
done
wait
}
extract() {
echo
for pack in $1; do
name="$(cut -d ':' -f 1 <<<"$pack")"
path="$(cut -d ':' -f 2 <<<"$pack")"
dir="tmp/$(cut -d '/' -f 2 <<<"$path")"
directories="DIRS$(cut -d ':' -f 3 <<<"$pack")"
subtree="$(cut -d ':' -f 4 <<<"$pack")"
output "- [$name](https://github.com/$path) ("
subdirs=""
for subdir in ${!directories}; do
if [ -d "${dir}${subtree:-/}${subdir}" ]; then
base="$(basename "$subdir")"
if [[ "$subdirs" != *"$base"* ]]; then
subdirs="$subdirs, $base"
fi
copy_dir "${dir}${subtree}" "$subdir" "$name"
fi
done
# syntax for go.vim depends on autoload for go.vim, but we exclude the
# autoload always and the ftplugin because it's too complex. FML.
if [ "${pack%%:*}" = "go" ]; then
copy_file "${dir}${subtree}" "${dir}${subtree}/autoload/go/config.vim" "${name}"
fi
output "${subdirs##, })"$'\n'
done
for pack in $1; do
name="$(cut -d ':' -f 1 <<<"$pack")"
path="$(cut -d ':' -f 2 <<<"$pack")"
dir="tmp/$(cut -d '/' -f 2 <<<"$path")"
subtree="$(cut -d ':' -f 4 <<<"$pack")"
if [ -d "$dir${subtree:-/}plugin" ]; then
echo "Possible error (plugin directory exists): $path" >&2
fi
done
}
copy_dir() {
find "$1/$2" \( -name '*.vim' -o -name '*.vital' -o -name '*.ctags' \) -print0 | while read -r -d $'\0' file; do
copy_file "$1" "$file" "$3"
done
}
copy_file() {
## $1 is the build dir (e.g. tmp/vim-go)
## $2 is the full file path, as returned by `find` (e.g. tmp/vim-go/indent/go.vim)
## $3 is the name of the package (so that we can detect if it's disabled at runtime)
local tmp_dir="$1"
local file_in_tmp="$2"
local file_basename="${2##*/}"
local file_path="${file_in_tmp##$tmp_dir/}" # Just this file's (full) path
file_path="${file_path%/*}" # Minus the actual name of the file
local file_in_dst="${file_path}/${file_basename}" # Could also be ${file_in_tmp##$tmp_dir/}
local package_name="$3"
if [ "${file_in_tmp##$tmp_dir/}" != "${file_in_dst}" ]; then
echo "Failure in logic in build script; '${file_in_tmp##$tmp_dir/}' != '${file_in_dst}'. Bailing." >&2
exit 1
fi
mkdir -p "${file_path}"
(
if [[ "${package_name}" == "jsx" ]]; then
printf "if !exists('g:polyglot_disabled') || !(index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'jsx') != -1)\n\n"
else
printf "if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, '$package_name') == -1\n\n"
fi
cat "$file_in_tmp"
printf "\nendif\n"
) >> "$file_in_dst"
}
update_readme() {
local tf of
tf="$(mktemp)"
of="$(mktemp)"
LC_ALL=C sort <<<"$OUTPUT" | grep -vxE '[[:space:]]*' > "$of"
awk 'suppress == 0 {
gsub(/<!--Package Count-->[^<]*<!--\/Package Count-->/,
"<!--Package Count-->'"$(awk 'END {print NR}' "$of")"'<!--/Package Count-->");
print;
}
/<!--Language Packs-->/ {
suppress = 1;
while ( ( getline line < "'"$of"'" ) > 0 ) {
print line;
}
}
/<!--\/Language Packs-->/ {
suppress = 0;
print;
}' "README.md" >"$tf"
mv "$tf" "README.md"
}
PACKS="
acpiasl:martinlroth/vim-acpi-asl
ansible:pearofducks/ansible-vim
apiblueprint:sheerun/apiblueprint.vim
applescript:mityu/vim-applescript:_SYNTAX
arduino:sudar/vim-arduino-syntax
asciidoc:asciidoc/vim-asciidoc
autohotkey:hnamikaw/vim-autohotkey
blade:jwalton512/vim-blade
brewfile:bfontaine/Brewfile.vim
c++11:octol/vim-cpp-enhanced-highlight
c/c++:vim-jp/vim-cpp
caddyfile:isobit/vim-caddyfile
carp:hellerve/carp-vim
cjsx:mtscout6/vim-cjsx
clojure:guns/vim-clojure-static
cmake:pboettch/vim-cmake-syntax
coffee-script:kchmck/vim-coffee-script:_NOAFTER
cql:elubow/cql-vim
cryptol:victoredwardocallaghan/cryptol.vim
crystal:rhysd/vim-crystal
csv:chrisbra/csv.vim
cucumber:tpope/vim-cucumber
cue:mgrabovsky/vim-cuesheet
dart:dart-lang/dart-vim-plugin
dhall:vmchale/dhall-vim
dlang:JesseKPhillips/d.vim
dockerfile:ekalinin/Dockerfile.vim
elixir:elixir-lang/vim-elixir
elm:andys8/vim-elm-syntax
emberscript:yalesov/vim-ember-script
emblem:yalesov/vim-emblem
erlang:vim-erlang/vim-erlang-runtime
fennel:bakpakin/fennel.vim
ferm:vim-scripts/ferm.vim
fish:georgewitteman/vim-fish
flatbuffers:dcharbon/vim-flatbuffers
fsharp:ionide/Ionide-vim:_BASIC
gdscript:calviken/vim-gdscript3:_SYNTAX
git:tpope/vim-git
glsl:tikhomirov/vim-glsl:_NOAFTER
gmpl:maelvalais/gmpl.vim
gnuplot:vim-scripts/gnuplot-syntax-highlighting
go:fatih/vim-go:_BASIC
graphql:jparise/vim-graphql:_ALL
gradle:tfnico/vim-gradle
haml:sheerun/vim-haml
handlebars:sheerun/vim-mustache-handlebars
haproxy:CH-DanReif/haproxy.vim
haskell:neovimhaskell/haskell-vim
haxe:yaymukund/vim-haxe
hcl:b4b4r07/vim-hcl
helm:towolf/vim-helm
hive:zebradil/hive.vim
html5:othree/html5.vim
i3:mboughaba/i3config.vim
icalenadr:chutzpah/icalendar.vim
idris:idris-hackers/idris-vim
ion:vmchale/ion-vim
javascript:pangloss/vim-javascript:_JAVASCRIPT
jenkins:martinda/Jenkinsfile-vim-syntax
jinja:lepture/vim-jinja
jq:vito-c/jq.vim
json5:GutenYe/json5.vim
json:elzr/vim-json
jsonnet:google/vim-jsonnet
jst:briancollins/vim-jst
jsx:MaxMEllon/vim-jsx-pretty:_ALL
julia:JuliaEditorSupport/julia-vim
kotlin:udalov/kotlin-vim
ledger:ledger/vim-ledger:_BASIC
less:groenewege/vim-less:_NOAFTER
lilypond:anowlcalledjosh/vim-lilypond
livescript:gkz/vim-ls
llvm:rhysd/vim-llvm
log:MTDL9/vim-log-highlighting
lua:tbastos/vim-lua
mako:sophacles/vim-bundle-mako
markdown:plasticboy/vim-markdown:_NOAFTER
mathematica:voldikss/vim-mma
mdx:jxnblk/vim-mdx-js
meson:mesonbuild/meson:_ALL:/data/syntax-highlighting/vim/
moonscript:leafo/moonscript-vim
nginx:chr4/nginx.vim
nim:zah/nim.vim:_BASIC
nix:LnL7/vim-nix
objc:b4winckler/vim-objc
ocaml:rgrinberg/vim-ocaml
octave:McSinyx/vim-octave
opencl:petRUShka/vim-opencl
perl:vim-perl/vim-perl
pgsql:lifepillar/pgsql.vim
php:StanAngeloff/php.vim
plantuml:aklt/plantuml-syntax
pony:jakwings/vim-pony
powershell:PProvost/vim-ps1
protobuf:uarun/vim-protobuf
pug:digitaltoad/vim-pug
puppet:rodjek/vim-puppet
purescript:purescript-contrib/purescript-vim
python-compiler:aliev/vim-compiler-python
python-indent:Vimjas/vim-python-pep8-indent
python:vim-python/python-syntax
qmake:artoj/qmake-syntax-vim
qml:peterhoeg/vim-qml
r-lang:vim-scripts/R.vim:_BASIC
racket:wlangstroth/vim-racket
ragel:jneen/ragel.vim
raku:Raku/vim-raku
raml:IN3D/vim-raml
razor:adamclerk/vim-razor
reason:reasonml-editor/vim-reason-plus
requirements:raimon49/requirements.txt.vim
rspec:keith/rspec.vim
rst:marshallward/vim-restructuredtext
ruby:vim-ruby/vim-ruby
rust:rust-lang/rust.vim
sbt:derekwyatt/vim-sbt
scala:derekwyatt/vim-scala
scss:cakebaker/scss-syntax.vim
sh:arzg/vim-sh
slim:slim-template/vim-slim
slime:slime-lang/vim-slime-syntax
smt2:bohlender/vim-smt2
solidity:tomlion/vim-solidity
sql:shmup/vim-sql-syntax
stylus:wavded/vim-stylus
svelte:evanleck/vim-svelte#main
svg-indent:jasonshell/vim-svg-indent
svg:vim-scripts/svg.vim
swift:keith/swift.vim
sxhkd:baskerville/vim-sxhkdrc
systemd:wgwoods/vim-systemd-syntax
terraform:hashivim/vim-terraform
textile:timcharper/textile.vim
thrift:solarnz/thrift.vim
tmux:ericpruitt/tmux.vim:_ALL:/vim/
tomdoc:wellbredgrapefruit/tomdoc.vim
toml:cespare/vim-toml
tptp:c-cube/vim-tptp
twig:lumiliet/vim-twig
typescript:HerringtonDarkholme/yats.vim
unison:unisonweb/unison#trunk:_ALL:/editor-support/vim/
v:ollykel/v-vim
vala:arrufat/vala.vim
vbnet:vim-scripts/vbnet.vim
vcl:smerrill/vcl-vim-plugin
vifm:vifm/vifm.vim
vm:lepture/vim-velocity
vue:posva/vim-vue
xdc:amal-khailtash/vim-xdc-syntax
xml:amadeus/vim-xml
xls:vim-scripts/XSLT-syntax
yaml:stephpy/vim-yaml
yard:sheerun/vim-yardoc
zephir:xwsoul/vim-zephir
zig:ziglang/zig.vim
zinit:zinit-zsh/zplugin-vim-syntax
"
python3 build.py
rm -rf tmp
mkdir tmp
printf "Downloading packs..."
download "$(sed '/^#/d' <<<"$PACKS")"
rm -rf "${DIRS_RM[@]}"
extract "$(sed '/^#/d' <<<"$PACKS")"
update_readme
rm -rf tmp
|