-
Notifications
You must be signed in to change notification settings - Fork 0
/
vim_setup.sh
executable file
·121 lines (105 loc) · 3.66 KB
/
vim_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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#!/usr/bin/env bash
#
# Setup file for Vim
#
# Created by Strex @ 3/26/18
#
# Check out our env
ver () {
if [ -e "/etc/oracle-release" ]; then
OS="Oracle Enterprise Linux"
VERV=$(cut -d ' ' -f5 < /etc/oracle-release)
elif [ -e "/etc/redhat-release" ]; then
OS="RedHat Enterprise Linux"
VERV=$(cut -d ' ' -f7 < /etc/redhat-release)
elif [ -e "/etc/SuSE-release" ]; then
OS="SUSE Linux Enterprise Server"
VERV=$(grep VERSION_ID /etc/os-release |cut -d '"' -f2)
elif [ -e "/etc/debian_version" ]; then
OS="Debian"
VERV=$(cat /etc/debian_version);
elif [ "$(uname)" == "Darwin" ]; then
OS="Darwin"
VERV="Unknown"
elif [ "$(uname)" == "MINGW64_NT" ] || [ "$(uname)" == "MINGW64_NT" ]; then
OS="Cygwin"
VERV="Unknown"
fi
# if [ -e "/bin/uname" ]; then
# VERR=$(uname -r |sed 's/.x86.*//g')
# elif [ -e "/proc/version" ]; then
# VERR=$(cut -d ' ' -f3 < /proc/version)
# fi
printf "%s$OS $VERV"
}
# Vim Install function
vim-install () {
if [ "$OS" == "Oracle Enterprise Linux" ]; then
sudo yum install -y vim
elif [ "$OS" == "RedHat Enterprise Linux" ]; then
sudo yum install -y vim
elif [ "$OS" == "SUSE Linux Enterprise Server" ]; then
sudo zypper install -y vim
elif [ "$OS" == "Debian" ]; then
sudo apt-get install -y vim
elif [ "$OS" == "Darwin" ]; then
if [[ -z $( command -v brew ) ]]; then
sudo brew install vim
else
printf "Looks like brew is not installed, please see: https://brew.sh/"
exit 0
fi
elif [[ $OS == "Cygwin" ]]; then
printf "Please re-run the Cygwin installer, and install vim.\\n"
exit 0
fi
}
if [[ $EUID -eq 0 ]]; then
read -p "Are you sure you want to run this as root (y|n)? " ANS
case $ANS in
y|Y) echo "Continuing.."
;;
n|N) echo "Exiting.."
exit 1
;;
esac
fi
if [ -n "$(command -v vim)" ]; then
printf "Great, Vim's installed, proceeding\\n"
elif [ -z "$(command -v vim)" ]; then
printf "Looks like Vim's not installed\\n"
printf "Trying to install Vim\\n"
ver
vim-install
fi
if [[ -n "$( command -v vim)" ]]; then
# Make vim directories
printf "Setting up directories\\n"
mkdir -p ~/.vim/autoload ~/.vim/bundle ~/.vim/syntax ~/.vim/colors ~/.vim/ftdetect
# Installing custom vimrc file
printf "Setting up custom vimrc file\\n"
curl -LSso ~/.vim/vimrc https://raw.githubusercontent.com/xstrex/BashSnips/master/vim.rc
# Setting up pathogen
printf "Setting up pathogen.vim\\n"
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
# Installing Solarized Theme
printf "Installing distinguished theme\\n"
curl -LSso ~/.vim/colors/distinguished.vim https://raw.githubusercontent.com/xstrex/BashSnips/master/Vim-Colors/distinguished.vim
# Installing Vividchalk Theme
printf "Installing Vividchalk theme\\n"
curl -LSso ~/.vim/colors/vividchalk.vim https://raw.githubusercontent.com/xstrex/BashSnips/master/Vim-Colors/vividchalk.vim
# Installing Hashpunk Theme
printf "Installing Hashpunk theme\\n"
curl -LSso ~/.vim/colors/hashpunk.vim https://raw.githubusercontent.com/xstrex/BashSnips/master/Vim-Colors/hashpunk.vim
# Installing monit syntax highlighting
printf "Installing Monit syntax highlighting\\n"
curl -LSso ~/.vim/syntax/monitrc.vim https://raw.githubusercontent.com/xstrex/BashSnips/master/Vim-Syntax/monitrc.vim
curl -LSso ~/.vim/ftdetect/monitrc.vim https://raw.githubusercontent.com/xstrex/BashSnips/master/Vim-Syntax/monitrc.ft
# Done
printf "Vim is installed and configured\\n"
printf "Rad!\\n"
exit 0
elif [[ -z "$( command -v vim)" ]]; then
printf "Looks like something went wrong with the install, please install vim manually..\\n"
exit 1
fi