-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.sh
92 lines (81 loc) · 2.27 KB
/
configure.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
#/bin/bash
setup_configs() {
# bashrc
if [[ -e $HOME/.bashrc ]]; then
cp $HOME/.bashrc $HOME/.bashrc.old
fi
if [[ -e $HOME/.bash_aliases ]]; then
cp $HOME/.bash_aliases $HOME/.bash_aliases.old
fi
if [[ -e $HOME/.bash_profile ]]; then
cp $HOME/.bash_profile $HOME/.bash_profile.old
fi
if [[ $PLATFORM = "mac" ]]; then
cp mac/bashrc $HOME/.bashrc
else
cp linux/bashrc $HOME/.bashrc
fi
echo -ne "\n" >> $HOME/.bashrc
cat common/bashrc >> $HOME/.bashrc
cat common/bash_aliases >> $HOME/.bash_aliases
cat common/bash_profile >> $HOME/.bash_profile
# bash_helpers
if [[ -e $HOME/.bash_helpers ]]; then
rm -rf $HOME/.bash_helpers.old
mv $HOME/.bash_helpers $HOME/.bash_helpers.old
fi
cp -r common/bash_helpers $HOME/.bash_helpers
# tmux
if [[ -e $HOME/.tmux.conf ]]; then
cp $HOME/.tmux.conf $HOME/.tmux.conf.old
fi
cp common/tmux $HOME/.tmux.conf
# vim
if [[ -e $HOME/.vimrc ]]; then
cp $HOME/.vimrc $HOME/.vimrc.old
fi
cp common/vimrc $HOME/.vimrc
mkdir -p $HOME/.vim/ftplugin
cp common/vim/c.vim $HOME/.vim/ftplugin/
# vim persistent undo
mkdir -p $HOME/.vim/undodir
# git
if [[ -e $HOME/.gitconfig ]]; then
cp $HOME/.gitconfig $HOME/.gitconfig.old
fi
cp common/gitconfig $HOME/.gitconfig
}
install_plugins() {
# tmux tpm
if [[ -e $HOME/.tmux ]]; then
rm -rf $HOME/.tmux
fi
install_dir="$HOME/.tmux/plugins/tpm"
if [ ! -d $install_dir ]; then
git clone https://github.com/tmux-plugins/tpm $install_dir
fi
$HOME/.tmux/plugins/tpm/bin/install_plugins
# vim
install_dir="$HOME/.vim/bundle/Vundle.vim"
if [ ! -d $install_dir ]; then
echo $install_dir
git clone https://github.com/VundleVim/Vundle.vim.git $install_dir
fi
vim +PluginInstall +qall
}
while [ "$#" -gt 0 ]; do
case "$1" in
-p) PLATFORM="$2"; shift 2;;
--platform=*) PLATFORM="${1#*=}"; shift 1;;
--install-only) INSTALL_ONLY=true; shift 1;;
esac
done
if [[ -z "$PLATFORM" ]]; then
echo "set platform -p or --platform=<linux|mac>"
exit 1
fi
# should I configure?
if [[ -z "$INSTALL_ONLY" ]]; then
setup_configs
fi
install_plugins