forked from kepbod/ivim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
87 lines (76 loc) · 2.21 KB
/
setup.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
83
84
85
86
87
#!/usr/bin/env bash
help() {
echo "setup.sh -- setup ivim"
echo "Usage: setup.sh -i/-n"
echo "-i -- install ivim"
echo "-n -- update ivim"
exit 0
}
color_print() {
printf '\033[0;31m%s\033[0m\n' "$1"
}
warn() {
color_print "$1" >&2
}
die() {
warn "$1"
exit 1
}
logo() {
color_print "Thank you for installing ivim!"
color_print ' _ _ '
color_print ' (_) __(_)___ ___ '
color_print ' / / | / / / __ `__ \'
color_print ' / /| |/ / / / / / / /'
color_print '/_/ |___/_/_/ /_/ /_/ '
color_print ' '
}
require() {
color_print "Checking requirements for ivim..."
color_print "Checking vim version..."
vim --version | grep 7.[3-9] || die "Your vim's version is too low!\nPlease download higher version(7.3+) from http://www.vim.org/download.php"
color_print "Checking if git exists..."
which git || die "No git installed!\nPlease install git from http://git-scm.com/downloads/"
color_print "Check if ctags exists..."
which ctags || warn "No ctags installed!\nPlease install ctags form http://ctags.sourceforge.net/ after ivim intallation!"
}
backup() {
color_print "Backing up current vim config..."
for i in $HOME/.vim $HOME/.vimrc $HOME/.gvimrc; do [ -e $i ] && mv -f $i $i.backup; done
}
install() {
color_print "Cloning ivim..."
rm -rf $HOME/ivim
git clone git://github.com/kepbod/ivim.git $HOME/ivim
ln -s $HOME/ivim/vimrc $HOME/.vimrc
color_print "Installing NeoBundle..."
git clone git://github.com/Shougo/neobundle.vim.git $HOME/.vim/bundle/neobundle.vim
color_print "Installing plugins using NeoBundle..."
$HOME/.vim/bundle/neobundle.vim/bin/neoinstall > /dev/null 2>&1
color_print "ivim has been installed. Just enjoy vimming!"
}
update() {
color_print "updating ivim..."
git pull origin master
$HOME/.vim/bundle/neobundle.vim/bin/neoinstall > /dev/null 2>&1
}
if [ $# -ne 1 ]; then
help
fi
while getopts ":in" opts; do
case $opts in
i)
logo
require
backup
install
;;
n)
update
;;
:)
help;;
?)
help;;
esac
done