-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.sh
79 lines (65 loc) · 2.95 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
#!/usr/bin/env bash
wrapper() {
RED="\033[0;31m"
GREEN="\033[0;32m"
YELLOW="\033[0;33m"
BLUE="\033[0;36m"
NORMAL="\033[0m"
REPO_HTTPS="https://github.com/jgc93/vimconfig.git"
VUNDLE_HTTPS="https://github.com/VundleVim/Vundle.vim.git"
echo "${BLUE}"
cat << "HELLO_TEXT"
iiii
i::::i
iiii
vvvvvvv vvvvvvviiiiiii mmmmmmm mmmmmmm rrrrr rrrrrrrrr cccccccccccccccc
v:::::v v:::::v i:::::i mm:::::::m m:::::::mm r::::rrr:::::::::r cc:::::::::::::::c
v:::::v v:::::v i::::i m::::::::::mm::::::::::mr:::::::::::::::::r c:::::::::::::::::c
v:::::v v:::::v i::::i m::::::::::::::::::::::mrr::::::rrrrr::::::rc:::::::cccccc:::::c
v:::::v v:::::v i::::i m:::::mmm::::::mmm:::::m r:::::r r:::::rc::::::c ccccccc
v:::::v v:::::v i::::i m::::m m::::m m::::m r:::::r rrrrrrrc:::::c
v:::::v:::::v i::::i m::::m m::::m m::::m r:::::r c:::::c
v:::::::::v i::::i m::::m m::::m m::::m r:::::r c::::::c ccccccc
v:::::::v i::::::im::::m m::::m m::::m r:::::r c:::::::cccccc:::::c
v:::::v i::::::im::::m m::::m m::::m r:::::r c:::::::::::::::::c
v:::v i::::::im::::m m::::m m::::m r:::::r cc:::::::::::::::c
vvv iiiiiiiimmmmmm mmmmmm mmmmmm rrrrrrr cccccccccccccccc
HELLO_TEXT
echo "${NORMAL}"
if [ ! -n "$VIM" ]; then
VIM=~/.vim
fi
if [ -d "$VIM" ]; then
printf "${YELLOW}%s${NORMAL}\n" "You already have $VIM directory."
printf "${YELLOW}%s${NORMAL}\n" "Removing old $VIM for you..."
sudo rm -r ~/.vim
exit 0
fi
umask g-w,o-w
printf "${BLUE}%s${NORMAL}\n" "Cloning vimrc from ${REPO_HTTPS}"
hash git >/dev/null 2>&1 || {
printf "${RED}%s${NORMAL}\n" "Error: git is not installed."
exit 1
}
env git clone --depth=1 $REPO_HTTPS $VIM || {
printf "${RED}%s${NORMAL}\n" "Error: git clone of vimrc repo failed."
exit 1
}
printf "${BLUE}%s${NORMAL}\n" "Looking for an existing vim config..."
if [ -f ~/.vimrc ] || [ -h ~/.vimrc ]; then
printf "${YELLOW}%s${NORMAL}\n" "Found ~/.vimrc."
printf "${BLUE}%s${NORMAL}\n" "You will see your old ~/.vimrc as $VIM/vimrc.bak"
mv ~/.vimrc $VIM/vimrc.bak
fi
printf "${BLUE}%s${NORMAL}\n" "Symlinking $VIM/vimrc with ~/.vimrc..."
ln -fs $VIM/vimrc ~/.vimrc
if [ ! -d "$VIM/bundle/Vundle.vim" ]; then
printf "${BLUE}%s${NORMAL}\n" "Installing Vundle..."
env git clone --depth=1 $VUNDLE_HTTPS "$VIM/bundle/Vundle.vim"
fi
printf "${GREEN}%s${NORMAL}\n" "Vimrc has been configured ;)"
printf "${YELLOW}%s${NORMAL}\n" "Do not worry about error messages. When it occurs just press enter and wait till all plugins are installed."
printf "${BLUE}%s${NORMAL}\n" "Keep calm and use VIM!"
}
wrapper
vim +PluginInstall