-
-
Notifications
You must be signed in to change notification settings - Fork 90
/
update.sh
executable file
·82 lines (73 loc) · 1.79 KB
/
update.sh
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
#!/usr/bin/env zsh
# (this can run in bash without modification)
#
# Usage: ./update.sh [pattern]
#
# Specify [pattern] to update only repos that match the pattern.
plugins=(
# Functionality
airblade/vim-gitgutter
docunext/closetag.vim
ervandew/supertab
haya14busa/incsearch.vim
itchyny/lightline.vim
junegunn/fzf.vim
junegunn/goyo.vim
junegunn/limelight.vim
qpkorr/vim-bufkill
scrooloose/nerdtree
tikhomirov/vim-glsl
tpope/vim-commentary
tpope/vim-endwise
tpope/vim-eunuch
tpope/vim-fugitive
tpope/vim-pathogen
tpope/vim-repeat
tpope/vim-sleuth
tpope/vim-surround
tpope/vim-unimpaired
wellle/targets.vim
# Syntax (polyglot being the most important)
alampros/vim-styled-jsx
ledger/vim-ledger
sheerun/vim-polyglot
statico/vim-inform7
# Colors
arcticicestudio/nord-vim
ntk148v/vim-horizon
tomasr/molokai
)
set -e
dir=~/.dotfiles/.vim/bundle
if [ -d "$dir" -a -z "$1" ]; then
if which trash &>/dev/null; then
echo "▲ Moving old bundle dir to trash"
trash "$dir"
elif which gio &>/dev/null; then
echo "▲ Moving old bundle dir to trash"
gio trash "$dir"
else
temp="$(mktemp -d)"
echo "▲ Moving old bundle dir to $temp"
mv "$dir" "$temp"
fi
fi
mkdir -p "$dir"
for repo in ${plugins[@]}; do
if [ -n "$1" ]; then
if ! (echo "$repo" | grep -i "$1" &>/dev/null) ; then
continue
fi
fi
plugin="$(basename $repo | sed -e 's/\.git$//')"
[ "$plugin" = "vim-styled-jsx" ] && plugin="000-vim-styled-jsx" # https://goo.gl/tJVPja
dest="$dir/$plugin"
rm -rf "$dest"
(
git clone --depth=1 -q "https://github.com/$repo" "$dest"
rm -rf "$dest/.git"
echo "· Cloned $repo"
[ "$plugin" = "onehalf" ] && (mv "$dest" "$dest.TEMP" && mv "$dest.TEMP/vim" "$dest" && rm -rf "$dest.TEMP")
) &
done
wait