-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.sh
executable file
·82 lines (73 loc) · 2.31 KB
/
bootstrap.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
#!/usr/bin/env bash
echo "Creating src directory"
mkdir -p ~/src
mkdir -p ~/.config/bat
# Install dependencies/tools
echo "Installing vim-plug & zgen"
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://github.com/junegunn/vim-plug/master/plug.vim
if [[ ! -d "$HOME/.zgen" ]]; then
git clone https://github.com/tarjoilija/zgen ~/.zgen
else
zgen update
fi
# Clone repos
if [[ ! -d "$HOME/src/vimrc" ]]; then
git clone https://github.com/dmiedema/vimrc.git ~/src/vimrc
else
pushd ~/src/vimrc; git pull origin main; popd
fi
if [[ ! -d "$HOME/src/zshrc" ]]; then
git clone https://github.com/dmiedema/zshrc.git ~/src/zshrc
else
pushd ~/src/zshrc; git pull origin main; popd;
fi
if [[ ! -d "$HOME/src/tmux" ]]; then
git clone https://github.com/dmiedema/tmux.conf.git ~/src/tmux.conf
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
else
pushd ~/src/tmux; git pull origin main; popd;
fi
# Link dotfiles
echo "Linking dotfiles"
if [[ ! -a "$HOME/.vimrc" ]]; then
ln -s ~/src/vimrc/vimrc "$HOME/.vimrc"
ln -s ~/src/vimrc/vimrc.bundles "$HOME/.vimrc.bundles"
fi
if [[ ! -a "$HOME/.ycm_extra_conf.py" ]]; then
ln -s ~/src/vimrc/ycm_extra_conf.py "$HOME/.ycm_extra_conf.py"
fi
if [[ ! -a "$HOME/.zshrc" ]]; then
ln -s ~/src/zshrc/zshrc "$HOME/.zshrc"
fi
if [[ ! -a "$HOME/.tmux.conf" ]]; then
ln -s ~/src/tmux.conf/tmux.conf "$HOME/.tmux.conf"
fi
if [[ ! -a "$HOME/.tmuxlinesnapshot.conf" ]]; then
ln -s ~/src/tmux.conf/tmuxlinesnapshot.conf.wombat256 "$HOME/.tmuxlinesnapshot.conf"
fi
if [[ ! -a "$HOME/.aliases" ]]; then
ln -s ~/src/zshrc/aliases "$HOME/.aliases"
fi
if [[ ! -a "$HOME/.config/bat/config" ]]; then
ln -s ~/src/zshrc/bat_config "$HOME/.config/bat/config"
fi
function __add_swift_to_zshrc_local() {
echo "export PATH=/usr/share/src/swift/usr/bin:$PATH" >> "$HOME/.zshrc.local"
}
if [[ "$OSTYPE" != "darwin"* ]]; then
SWIFT_INSTALLED=$(which swift &> /dev/null)
if [[ $SWIFT_INSTALLED ]]; then
if [[ -a "$HOME/.zshrc.local" ]]; then
IN_ZSHRC_LOCAL=$(grep -c 'swift' "$HOME/.zshrc.local")
if [[ $IN_ZSHRC_LOCAL -eq 0 ]]; then
__add_swift_to_zshrc_local
fi
else
__add_swift_to_zshrc_local
fi
fi # SWIFT_INSTALLED
fi # not darwin platform
echo "Installing Vim Plugins"
vim +PlugInstall +qall
zsh # run ZSH to clone the repos down