-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate
More file actions
executable file
·44 lines (35 loc) · 915 Bytes
/
update
File metadata and controls
executable file
·44 lines (35 loc) · 915 Bytes
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
#!sh
# update:
# 1. read the plugins file
# 2. git pull each one
echo "* vimdot plugin updater"
INSTALL_PATH=~/.vim/pack/plugins/start
OPT_PATH=~/.vim/pack/plugins/opt
# helper func
beginswith() { case $2 in "$1"*) true;; *) false;; esac; }
echo -------------------------------------------------
echo "* updating plugins"
silent_pull() {
if beginswith opt: $1; then
parsed=$(echo $1 | cut -d":" -f2)
name=${parsed##*/}
loc=${OPT_PATH}/$name
else
name=${1##*/}
loc=${INSTALL_PATH}/$name
fi
if [ -d $loc ]; then # pull only if it is installed
cd $loc
git fetch --depth=1 --quiet
git reset --hard @{u} --quiet
echo "~ $name"
fi
}
while read -r plugin; do
if [ $plugin ]; then
silent_pull $plugin &
fi
done <./plugins
wait
echo -------------------------------------------------
echo "* finished updating plugins"