-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap
executable file
·82 lines (67 loc) · 2 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
#!/bin/zsh
curDir=$(dirname ${(%):-%x})
cd $curDir
git pull origin master
if [ ! -f $HOME/.oh-my-zsh/oh-my-zsh.sh ]; then
echo "Oh no! Oh My Zsh is not installed! Please visit https://ohmyz.sh for installation instructions. Execute me again when Oh My Zsh is installed."
exit 1
fi
if [ ! -d $ZSH_CUSTOM/themes/powerlevel10k ]; then
echo "Snap! Powerlevel10k is not installed! Please follow https://github.com/romkatv/powerlevel10k#oh-my-zsh for installation instructions. Execute me again when Powerlevel10k is installed."
exit 1
fi
function clone_external_plugins() {
echo "Cloning external plugins..."
customPluginthemeDir=$ZSH_CUSTOM/plugins
externalPlugins=(
zsh-users/zsh-autosuggestions
zsh-users/zsh-syntax-highlighting
)
for repo in $externalPlugins; do
if [ ! -d $customPluginthemeDir/${repo:t} ]; then
git clone https://github.com/${repo} $customPluginthemeDir/${repo:t}
fi
done
}
function init() {
includes=(
".zsh"* # leave * outside the quotes to enable the wildcard
".p10k.zsh"
".aliases"
".gitconfig"
".git"*".txt"
".tmux.conf"
)
# following folders are not symlinked because they might contain custom user's executables
exception_folders=(
".bin"
".config"
)
for include in $includes; do
ln -v -sf $PWD/$include $HOME
done
for exception in $exception_folders; do
mkdir -v -p $HOME/$exception
ln -v -sf $PWD/$exception/** $HOME/$exception
done
source ~/.zshrc
if [ $SHELL != '/bin/zsh' ]; then
chsh -s $(which zsh) # make zsh your default shell
fi
}
function configure_asdf() {
asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git
# Needs coreutils package
asdf plugin add golang https://github.com/asdf-community/asdf-golang.git
}
clone_external_plugins
configure_asdf
if [[ $1 == "--force" ]] || [[ $1 == "-f" ]]; then
init
else
# -q for yes/no answers
if read -q '?This may overwrite existing files in your home directory. Are you sure? (y/n)'; then
echo ""
init
fi
fi