-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
executable file
·72 lines (56 loc) · 1.64 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
#!/bin/bash
CONFIG_DIR=$HOME/.config
NVIM_DIR=$CONFIG_DIR/nvim
TMUX_DIR=$HOME/.tmux
TMUX_CONF=$HOME/.tmux.conf
NVIM_CONF=$NVIM_DIR/init.vim
VIM_CONF=$HOME/.vimrc
ZSHRC=$HOME/.zshrc
ZSH_BULLET_TRAIN_THEME=$HOME/.oh-my-zsh/custom/themes/bullet-train.zsh-theme
LSD_DIR=$CONFIG_DIR/lsd
echo 'Checking for pre-existing files and directories'
function run_command() {
echo $1
eval $1
}
function prompt_user() {
while true; do
read -p "$1 Continue? (Y/N)" yn
case $yn in
[Yy]* ) break;;
[Nn]* ) exit;;
* ) echo "Please answer yes or no.";;
esac
done
}
function remove_pre_existing() {
if [ -e $1 ]; then
prompt_user "Removing pre-existing $1!"
run_command "rm -rf $1"
fi
}
function link() {
echo 'Symlinking' $2 ' -> ' $1
run_command "ln -s $1 $2"
}
remove_pre_existing $VIM_CONF
remove_pre_existing $NVIM_DIR
remove_pre_existing $TMUX_DIR
remove_pre_existing $TMUX_CONF
remove_pre_existing $ZSHRC
remove_pre_existing $ZSH_BULLET_TRAIN_THEME
remove_pre_existing $LSD_DIR
link `pwd`/zshrc $ZSHRC
echo 'zshrc file installed successfully!'
link `pwd`/nvim $NVIM_DIR
echo 'Nvim directory installed successfully!'
link `pwd`/tmux $TMUX_DIR
echo 'Tmux directory installed successfully!'
link `pwd`/tmux.conf $TMUX_CONF
echo 'Tmux conf installed successfully!'
link `pwd`/nvim/init.vim $VIM_CONF
echo 'Vim .vimrc compatability symlink installed successfully!'
link `pwd`/zsh_theme/bullet-train.zsh/bullet-train.zsh-theme $ZSH_BULLET_TRAIN_THEME
echo 'Bullet train ZSH theme was installed successfully!'
link `pwd`/lsd $LSD_DIR
echo 'LSD config dir installed successfully!'