vim-polyglot/build
2017-12-30 11:29:38 +01:00

231 lines
5.9 KiB
Bash
Executable File

#!/usr/bin/env bash
set -E
DIRS="syntax indent compiler autoload ftplugin after/syntax after/indent after/ftplugin"
DIRS_BASIC="syntax compiler indent after/syntax after/indent"
DIRS_ALL="syntax indent compiler autoload ftplugin after"
DIRS_SYNTAX="syntax after/syntax"
DIRS_JAVASCRIPT="${DIRS} extras"
DIRS_RM="$DIRS_JAVASCRIPT"
OUTPUT=""
output() {
OUTPUT="$OUTPUT$1"
printf -- "$1"
}
download() {
for pack in $1; do
path="$(printf "$pack" | cut -d ':' -f 2)"
dir="tmp/$(printf "$path" | cut -d '/' -f 2)"
rm -rf "$dir"
(mkdir -p "$dir" && curl --silent -L https://codeload.github.com/$path/tar.gz/master | tar -zx -C "$dir" --strip 1 && printf '.') &
done
wait
}
extract() {
printf "\n"
cat config.vim >> tmp/polyglot.vim
for pack in $1; do
name="$(printf "$pack" | cut -d ':' -f 1)"
path="$(printf "$pack" | cut -d ':' -f 2)"
dir="tmp/$(printf "$path" | cut -d '/' -f 2)"
directories="DIRS$(printf "$pack" | cut -d ':' -f 3)"
subtree="$(printf "$pack" | cut -d ':' -f 4)"
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
for f in ${dir}/ftdetect/*; do
(
echo "augroup filetypedetect";
echo '" '"$pack";
cat "${f}";
echo "augroup END";
echo
) >> tmp/polyglot.vim;
done
output "${subdirs##, })\n"
done
mv tmp/polyglot.vim ftdetect/
for pack in $1; do
name="$(printf "$pack" | cut -d ':' -f 1)"
path="$(printf "$pack" | cut -d ':' -f 2)"
dir="tmp/$(printf "$path" | cut -d '/' -f 2)"
subtree="$(printf "$pack" | cut -d ':' -f 4)"
if [ -d "$dir${subtree:-/}plugin" ]; then
printf "Possible error (plugin directory exists): $path\n"
fi
done
}
copy_dir() {
for file in $(find "$1/$2" -name '*.vim' -o -name '*.vital'); do
file_path="$(dirname "${file##$1/}")"
mkdir -p "$file_path"
touch "$file_path/$(basename "$file")"
# Use comma instead of / to handle cases like c/c++
sed -e "s,%%PACK%%,$3," -e "/%%CONTENT%%/{r $file" -e "d;}" plugin_guard.vim.template >> $file_path/$(basename "$file")
done
}
update_readme() {
OLD_README="$(cat README.md)"
ed README.md <<- EOF
/Language packs
+2kb
/##
'b,-2c
$(printf -- "$OUTPUT" | sort)
.
w
q
EOF
}
PACKS="
apiblueprint:sheerun/apiblueprint.vim
applescript:vim-scripts/applescript.vim
asciidoc:asciidoc/vim-asciidoc
yaml:stephpy/vim-yaml
ansible:pearofducks/ansible-vim
arduino:sudar/vim-arduino-syntax
autohotkey:hnamikaw/vim-autohotkey
blade:jwalton512/vim-blade
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
cryptol:victoredwardocallaghan/cryptol.vim
crystal:rhysd/vim-crystal
cql:elubow/cql-vim
cucumber:tpope/vim-cucumber
dart:dart-lang/dart-vim-plugin
dockerfile:docker/docker::/contrib/syntax/vim/
elixir:elixir-lang/vim-elixir
elm:ElmCast/elm-vim
emberscript:yalesov/vim-ember-script
emblem:yalesov/vim-emblem
erlang:vim-erlang/vim-erlang-runtime
fish:dag/vim-fish
fsharp:fsharp/vim-fsharp:_BASIC
git:tpope/vim-git
gmpl:maelvalais/gmpl.vim
glsl:tikhomirov/vim-glsl
gnuplot:vim-scripts/gnuplot-syntax-highlighting
go:fatih/vim-go:_BASIC
groovy:vim-scripts/groovy.vim
haml:sheerun/vim-haml
handlebars:mustache/vim-mustache-handlebars
haskell:neovimhaskell/haskell-vim
haxe:yaymukund/vim-haxe
html5:othree/html5.vim
i3:PotatoesMaster/i3-vim-syntax
jasmine:glanotte/vim-jasmine
javascript:pangloss/vim-javascript:_JAVASCRIPT
jenkins:martinda/Jenkinsfile-vim-syntax
json:elzr/vim-json
jst:briancollins/vim-jst
jsx:mxw/vim-jsx:_ALL
julia:JuliaEditorSupport/julia-vim
kotlin:udalov/kotlin-vim
latex:LaTeX-Box-Team/LaTeX-Box
less:groenewege/vim-less
liquid:tpope/vim-liquid
livescript:gkz/vim-ls
lua:tbastos/vim-lua
mako:sophacles/vim-bundle-mako
markdown:plasticboy/vim-markdown:_SYNTAX
mathematica:rsmenon/vim-mathematica
nginx:chr4/nginx.vim
nim:zah/nim.vim:_BASIC
nix:LnL7/vim-nix
objc:b4winckler/vim-objc
ocaml:jrk/vim-ocaml
octave:vim-scripts/octave.vim--
opencl:petRUShka/vim-opencl
perl:vim-perl/vim-perl
pgsql:exu/pgsql.vim
php:StanAngeloff/php.vim
plantuml:aklt/plantuml-syntax
powershell:PProvost/vim-ps1
protobuf:uarun/vim-protobuf
pug:digitaltoad/vim-pug
puppet:voxpupuli/vim-puppet
purescript:purescript-contrib/purescript-vim
python:mitsuhiko/vim-python-combined
python-compiler:aliev/vim-compiler-python
qml:peterhoeg/vim-qml
r-lang:vim-scripts/R.vim
racket:wlangstroth/vim-racket
raml:IN3D/vim-raml
ragel:jneen/ragel.vim
rspec:sheerun/rspec.vim
ruby:vim-ruby/vim-ruby
rust:rust-lang/rust.vim
sbt:derekwyatt/vim-sbt
scala:derekwyatt/vim-scala
scss:cakebaker/scss-syntax.vim
slim:slim-template/vim-slim
slime:slime-lang/vim-slime-syntax
solidity:tomlion/vim-solidity
stylus:wavded/vim-stylus
swift:keith/swift.vim
sxhkd:baskerville/vim-sxhkdrc
systemd:kurayama/systemd-vim-syntax
terraform:hashivim/vim-terraform
textile:timcharper/textile.vim
thrift:solarnz/thrift.vim
tmux:keith/tmux.vim
tomdoc:wellbredgrapefruit/tomdoc.vim
toml:cespare/vim-toml
twig:lumiliet/vim-twig
typescript:leafgarland/typescript-vim
vala:arrufat/vala.vim
vbnet:vim-scripts/vbnet.vim
vcl:smerrill/vcl-vim-plugin
vifm:vifm/vifm.vim
vue:posva/vim-vue
vm:lepture/vim-velocity
xls:vim-scripts/XSLT-syntax
yard:sheerun/vim-yardoc
"
rm -rf tmp
rm -rf $DIRS_RM
mkdir tmp
printf "Downloading packs..."
download "$PACKS"
extract "$PACKS"
update_readme
rm -rf tmp