This repository has been archived by the owner on Dec 26, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
/
install.sh
executable file
·84 lines (72 loc) · 1.83 KB
/
install.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
#!/usr/bin/env bash
## Check OS
if [[ "$OSTYPE" =~ "darwin" ]]
then
export OS="mac"
elif [[ "$OSTYPE" == "linux-gnu" ]]
then
export OS="linux"
else
echo "Don't know what to do with '$OSTYPE' operating system"
exit 1
fi
# Git and Curl required
if [[ $(which git) == "" ]]
then
echo "Install git ( http://git-scm.com ) first"
exit 1
fi
if [[ $(which curl) == "" ]]
then
echo "Install curl ( http://curl.haxx.se ) first"
exit 1
fi
export VIM_BACKUP_DIR="/tmp/dotvim-backup"
mkdir -p $VIM_BACKUP_DIR
echo "Backing up existing vim files to $VIM_BACKUP_DIR"
for f in $(ls -a $VIM_BACKUP_DIR| grep -v '^.$' | grep -v '^..$')
do
rm -rf "$VIM_BACKUP_DIR/$f"
done
for f in "$HOME/.vimrc" "$HOME/.gvimrc" "$HOME/.vimrc.local" "$HOME/.vim"
do
[[ -s "$f" ]] && mv -f "$f" $VIM_BACKUP_DIR
done
echo "Ensuring backup directory exists"
mkdir -p "$HOME/.vim/backup"
echo "Download Vundle"
mkdir -p "$HOME/.vim/bundle"
if [[ ! -d "$HOME/.vim/bundle/vundle" ]]
then
git clone http://github.com/gmarik/vundle.git "$HOME/.vim/bundle/vundle"
fi
echo "Link vimrc, gvimrc"
ln -s -f "$PWD/vimrc" "$HOME/.vimrc"
ln -s -f "$PWD/gvimrc" "$HOME/.gvimrc"
if [[ -f "$PWD/vimrc.local" ]]
then
ln -s -f "$PWD/vimrc.local" "$HOME/.vimrc.local"
fi
echo "Instruct Vundle to download all the scripts"
vim +BundleInstall +qall
echo "Custom snippets"
if [[ -d "$HOME/.vim/bundle/snipmate.vim" ]]
then
for snippet_file in $(ls snippets/*.snippets)
do
cat "$snippet_file" >> "$HOME/.vim/bundle/snipmate.vim/$snippet_file"
done
fi
echo "Custom ftplugins"
mkdir -p "$HOME/.vim/ftplugin"
for f in $(ls ftplugin/*)
do
ln -s -f "$PWD/$f" "$HOME/.vim/ftplugin"
done
echo "Custom after plugins"
mkdir -p "$HOME/.vim/after/plugin"
for f in $(ls after/plugin/*)
do
ln -s -f "$PWD/$f" "$HOME/.vim/after/plugin"
done
echo "Finished"