forked from ets-labs/python-vimrc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
90 lines (75 loc) · 3.57 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
88
89
90
#!/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/ets-labs/python-vimrc.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" "You have to remove $VIM if you want to re-install."
exit 0
fi
# Prevent the cloned repository from having insecure permissions. Failing to do
# so causes compinit() calls to fail with "command not found: compdef" errors
# for users with insecure umasks (e.g., "002", allowing group writability). Note
# that this will be ignored under Cygwin by default, as Windows ACLs take
# precedence over umasks except for filesystems mounted with option "noacl".
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
if [ ! -f $VIM/colors/wombat256mod.vim ]; then
if [ ! -d $VIM/colors/ ]; then
mkdir -p $VIM/colors
fi
wget 'http://www.vim.org/scripts/download_script.php?src_id=13400' -O $VIM/colors/wombat256mod.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