vim-polyglot/build

188 lines
4.6 KiB
Plaintext
Raw Normal View History

2013-09-14 14:48:46 -04:00
#!/usr/bin/env bash
2013-09-12 09:50:45 -04:00
2013-09-12 10:12:52 -04:00
set -E
2013-09-12 09:50:45 -04:00
DIRS="syntax indent compiler autoload ftplugin ftdetect after/syntax after/indent after/ftplugin after/ftdetect"
DIRS_BASIC="syntax compiler indent ftdetect after/syntax after/indent after/ftdetect"
2015-07-18 17:00:08 -04:00
DIRS_ALL="syntax indent compiler autoload ftplugin ftdetect after"
2013-09-12 09:50:45 -04:00
2015-07-18 16:34:26 -04:00
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"
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)"
2015-07-18 16:34:26 -04:00
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
2013-09-16 19:53:14 -04:00
2015-07-18 16:34:26 -04:00
output "${subdirs##, })\n"
done
2013-09-16 19:53:14 -04:00
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)"
2013-09-16 19:53:14 -04:00
if [ -d "$dir${subtree:-/}plugin" ]; then
2013-09-16 19:53:14 -04:00
printf "Possible error (plugin directory exists): $path\n"
fi
done
}
copy_dir() {
for file in $(find "$1/$2" -name '*.vim'); 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")
2013-09-12 09:50:45 -04:00
done
}
concat_ftdetect() {
cat ftdetect/* | grep -E '^[^"]' > tmp/polyglot.vim
rm -f ftdetect/*
mv tmp/polyglot.vim ftdetect/
}
2015-07-18 16:34:26 -04:00
update_readme() {
OLD_README="$(cat README.md)"
ed README.md <<- EOF
/Language packs
+2kb
/##
'b,-2c
$(printf -- "$OUTPUT")
.
w
q
EOF
}
PACKS="
arduino:sudar/vim-arduino-syntax
2015-12-06 05:31:01 -05:00
blade:jwalton512/vim-blade
c++11:octol/vim-cpp-enhanced-highlight
2015-12-06 05:31:01 -05:00
c/c++:vim-jp/vim-cpp
2015-10-24 06:06:19 -04:00
cjsx:mtscout6/vim-cjsx
clojure:guns/vim-clojure-static
coffee-script:kchmck/vim-coffee-script
2014-08-12 18:14:53 -04:00
css:JulesWang/css.vim
cucumber:tpope/vim-cucumber
2015-12-06 05:38:02 -05:00
dart:dart-lang/dart-vim-plugin
2013-09-26 06:48:01 -04:00
dockerfile:honza/dockerfile.vim
2015-12-06 05:53:26 -05:00
elm:lambdatoast/elm.vim
elixir:elixir-lang/vim-elixir
2014-04-14 19:14:47 -04:00
emberscript:heartsentwined/vim-ember-script
2014-08-12 18:03:22 -04:00
emblem:heartsentwined/vim-emblem
erlang:vim-erlang/vim-erlang-runtime
git:tpope/vim-git
glsl:tikhomirov/vim-glsl
go:fatih/vim-go:_BASIC
2015-10-10 11:17:57 -04:00
groovy:vim-scripts/groovy.vim
haml:tpope/vim-haml
handlebars:mustache/vim-mustache-handlebars
haskell:neovimhaskell/haskell-vim
2014-06-08 07:22:29 -04:00
haxe:yaymukund/vim-haxe
html5:othree/html5.vim
jade:digitaltoad/vim-jade
2014-04-14 19:12:18 -04:00
jasmine:glanotte/vim-jasmine
2015-07-19 12:57:00 -04:00
javascript:sheerun/yajs.vim
2015-12-06 05:39:05 -05:00
jinja:Glench/Vim-Jinja2-Syntax
json:sheerun/vim-json
jst:briancollins/vim-jst
2015-07-18 17:00:08 -04:00
jsx:mxw/vim-jsx:_ALL
2015-10-24 06:06:19 -04:00
julia:dcjones/julia-minimalist-vim
kotlin:udalov/kotlin-vim
latex:LaTeX-Box-Team/LaTeX-Box
less:groenewege/vim-less
2014-06-08 13:38:42 -04:00
liquid:tpope/vim-liquid
markdown:tpope/vim-markdown
nginx:nginx/nginx::/contrib/vim/
2015-12-17 04:47:00 -05:00
nix:spwhitt/vim-nix
objc:b4winckler/vim-objc
ocaml:jrk/vim-ocaml
octave:vim-scripts/octave.vim--
2014-03-16 09:52:12 -04:00
opencl:petRUShka/vim-opencl
2013-09-17 11:37:59 -04:00
perl:vim-perl/vim-perl
php:StanAngeloff/php.vim
2014-12-11 17:16:49 -05:00
powershell:Persistent13/vim-ps1
2013-09-14 05:36:13 -04:00
protobuf:uarun/vim-protobuf
2015-10-24 06:06:19 -04:00
puppet:rodjek/vim-puppet
2014-04-14 19:18:16 -04:00
python:mitsuhiko/vim-python-combined
2015-10-10 11:25:38 -04:00
qml:peterhoeg/vim-qml
2015-06-11 11:02:51 -04:00
ragel:jneen/ragel.vim
2015-10-24 06:06:19 -04:00
r-lang:vim-scripts/R.vim
rspec:sheerun/rspec.vim
ruby:vim-ruby/vim-ruby
2015-11-20 09:47:50 -05:00
rust:rust-lang/rust.vim
sbt:derekwyatt/vim-sbt
scala:derekwyatt/vim-scala
slim:slim-template/vim-slim
2015-07-18 17:00:08 -04:00
solidity:ethereum/vim-solidity
stylus:wavded/vim-stylus
2015-12-05 20:05:04 -05:00
swift:keith/swift.vim
2015-10-24 06:06:19 -04:00
systemd:kurayama/systemd-vim-syntax
textile:timcharper/textile.vim
2015-10-24 06:06:19 -04:00
thrift:solarnz/thrift.vim
tmux:tejr/vim-tmux
2015-12-06 05:31:01 -05:00
tomdoc:wellbredgrapefruit/tomdoc.vim
2014-04-14 19:16:56 -04:00
toml:cespare/vim-toml
twig:beyondwords/vim-twig
2015-10-24 06:06:19 -04:00
typescript:leafgarland/typescript-vim
2014-12-11 17:09:07 -05:00
vala:tkztmk/vim-vala
2015-10-24 06:06:19 -04:00
vbnet:vim-scripts/vbnet.vim
2015-12-06 05:34:19 -05:00
vcl:smerrill/vcl-vim-plugin
2014-12-22 16:01:38 -05:00
vm:lepture/vim-velocity
2015-10-24 06:06:19 -04:00
xls:vim-scripts/XSLT-syntax
yard:sheerun/vim-yardoc
"
2013-09-14 14:10:55 -04:00
rm -rf tmp
2015-07-18 17:00:08 -04:00
rm -rf $DIRS_ALL
2013-09-16 11:46:24 -04:00
mkdir tmp
2013-09-14 14:10:55 -04:00
printf "Downloading packs..."
download "$PACKS"
extract "$PACKS"
concat_ftdetect
2015-07-18 16:34:26 -04:00
update_readme
rm -rf tmp