-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall
More file actions
executable file
·70 lines (56 loc) · 1.59 KB
/
install
File metadata and controls
executable file
·70 lines (56 loc) · 1.59 KB
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
#!/bin/sh
# installer script to install vimdot
echo "* vimdot installer"
OPT_PATH=~/.vim/pack/plugins/opt
INSTALL_PATH=~/.vim/pack/plugins/start
# helper func
beginswith() { case $2 in "$1"*) true;; *) false;; esac; }
# check for config updates
if [ -z "$VIMDOT_UPDATED" ]; then
echo "* checking for config updates..."
git fetch --quiet
BEHIND=$(git rev-list --count HEAD..@{u} 2>/dev/null)
if [ "$BEHIND" -gt 0 ]; then
echo "* found $BEHIND new commits! pulling latest config..."
git diff HEAD..@{u} >changes.diff
echo "* saved changes to changes.diff"
git pull --quiet
echo "* restarting script..."
export VIMDOT_UPDATED=1
exec "$0" "$@"
else
echo "* no updates found..."
fi
fi
echo -------------------------------------------------
echo "* copying vimrc"
cp .vimrc ~
echo -------------------------------------------------
echo "* installing plugins"
# setup directory
cp -r .vim ~
# install the plugins
silent_clone() {
if beginswith opt: $1; then
parsed=$(echo $1 | cut -d":" -f2)
url=https://github.com/$parsed
name=${parsed##*/}
loc=${OPT_PATH}/$name
else
url=https://github.com/$1
name=${1##*/}
loc=${INSTALL_PATH}/$name
fi
if [ ! -d $loc ]; then # install plugin unless it already exists
git clone --depth=1 $url $loc --quiet
echo "+ $name"
fi
}
while read -r plugin; do
if [ $plugin ]; then
silent_clone $plugin &
fi
done <./plugins
wait
echo -------------------------------------------------
echo "* finished installing!"