-
Notifications
You must be signed in to change notification settings - Fork 1
/
bootstrap
executable file
·106 lines (91 loc) · 2.56 KB
/
bootstrap
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
#!/bin/sh
OIFS="`echo $IFS`"
if ! which git > /dev/null; then
echo "There is no git command in your system, please install one."
exit
fi
if [[ -f ~/.stanley-vim ]]; then
rm -rf ~/.stanley-vim
fi
if [[ -f ~/.vimrc.old ]]; then
rm -rf ~/.vimrc.old
fi
if [[ -f ~/.vimrc ]]; then
mv ~/.vimrc ~/.vimrc.old
fi
if [[ ! -d ~/.vim ]]; then
mkdir ~/.vim
fi
#change screeen settings
if [[ -f ~/.screenrc.old ]]; then
rm -rf ~/.screenrc.old
fi
if [[ -f ~/.screenrc ]]; then
mv ~/.screenrc ~/.screenrc.old
fi
#change tmux settings
if [[ -f ~/.tmux.conf.old ]]; then
rm -rf ~/.tmux.conf.old
fi
if [[ -f ~/.tmux.conf ]]; then
mv ~/.tmux.conf ~/.tmux.conf.old
fi
#change git settings
if [[ -f ~/.gitconfig.old ]]; then
rm -rf ~/.gitconfig.old
fi
if [[ -f ~/.gitconfig ]]; then
mv ~/.gitconfig ~/.gitconfig.old
fi
#change vimperator settings
if [[ -f ~/.vimperatorrc.old ]]; then
rm -rf ~/.vimperatorrc.old
fi
if [[ -f ~/.vimperatorrc ]]; then
mv ~/.vimperatorrc ~/.vimperatorrc.old
fi
if [[ -f ~/.vi-bashrc ]]; then
mv ~/.vi-bashrc ~/.vi-bashrc.old
fi
:<<'EOF'
if [[ -d ~/.emacs.d ]]; then
mv ~/.emacs.d ~/.emacs.d.bak
fi
EOF
git clone https://github.com/stanleyz/vim.conf ~/.stanley-vim
cp ~/.stanley-vim/vimrc ~/.vim/vimrc
cp ~/.stanley-vim/bundles.vim ~/.vim/bundles.vim
cp ~/.stanley-vim/bootstrap ~/.vim/bootstrap
cp ~/.stanley-vim/screenrc ~/.screenrc
cp ~/.stanley-vim/tmux.conf ~/.tmux.conf
cp ~/.stanley-vim/gitconfig ~/.gitconfig
cp ~/.stanley-vim/vimperatorrc ~/.vimperatorrc
cp ~/.stanley-vim/vi-bashrc ~/.vi-bashrc
#cp -a ~/.stanley-vim/emacs.d ~/.emacs.d
:<<'EOF'
if [[ "X$(uname)" == "XDarwin" ]]; then
[[ -f ~/.mac-bashrc ]] && mv ~/.mac-bashrc ~/.mac-bashrc.old
cp ~/.stanley-vim/mac-bashrc ~/.mac-bashrc
fi
EOF
# check if bash_profile has the *bashrc files
[[ ! -f ~/.bash_profile ]] && touch ~/.bash_profile
for f in .bashrc .vi-bashrc # .mac-bashrc
do
#[[ "X$(uname)" != "XDarwin" && "$f" == ".mac-bashrc" ]] && continue
[[ $(grep "/$f" ~/.bash_profile | wc -l | sed 's/^\ *//g') == 0 ]] && echo "[[ -s \"$HOME/$f\" ]] && source ~/$f" >> ~/.bash_profile
done
rm -rf ~/.stanley-vim
ln -s ~/.vim/vimrc ~/.vimrc
# install tmux plugins
if [[ ! -d ~/.tmux/plugins/ ]]; then
mkdir -p ~/.tmux/plugins
git clone git://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
fi
cd ~/.vim
if [[ ! -d ~/.vim/bundle/vundle/.git ]]; then
git clone git://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
fi
vim -c BundleInstall! -c q -c q -u bundles.vim < /dev/tty
echo -e "\n\n\033[33;31m Please ensure you have astyle / tidy / js-beautify installed for autoformat\n\n"
IFS="`echo $OIFS`"