-
Notifications
You must be signed in to change notification settings - Fork 1
/
bootstrap.sh
executable file
·72 lines (60 loc) · 2.07 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
source $DOTFILES_HOME/scripts/nvm.sh
download_tmux_plugin_manager() {
if [ ! -d ~/.tmux/plugins/tpm ]; then
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
fi
}
curl_git_scripts() {
local target_dir=$1
local git_completion_url='https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash'
local git_prompt_url='https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh'
local git_prompt_file=$target_dir/.git-prompt.sh
local git_completion_file=$target_dir/.git-completion.bash
if [ ! -f "$git_prompt_file" ]; then
echo "Loading $git_prompt_file"
curl -so "$git_prompt_file" $git_prompt_url
fi
if [ ! -f "$git_completion_file" ]; then
echo "Loading $git_completion_file"
curl -so "$git_completion_file" $git_completion_url
fi
}
# Basic symlinking
link() {
local base_dir=$1
local entries=$2
local is_overwritten=$3
for entry_name in $entries; do
ln -fFns "$base_dir/$entry_name" ~/"$entry_name"
if [ ! "$is_overwritten" ]; then
echo "Linked $entry_name."
else
echo "Linked ovewritten $entry_name."
fi
done
}
: ${dotfiles_dir:=~/dotfiles}
: ${base_dir:=~/dotfiles}
: ${entries:='.bash_profile .1p-session .bashrc .bash_aliases .vimrc .ssh/config .config/karabiner .tmux.conf .gitconfig .gitignore .editorconfig .mongorc.js .finicky.js'}
echo 'This script may overwrite some files in your $HOME'
read -p 'Do you want to continue (y/n)? ' yn
case $yn in
'y')
touch ~/.hushlogin
chsh -s /opt/homebrew/bin/bash
echo $BASH_VERSION
curl_git_scripts ~
download_tmux_plugin_manager
setup_nvm
link $base_dir "$entries"
# Set up Neovim
mkdir -p ~/.config/nvim
ln -fFns "$base_dir/.nvim/init.vim" ~/.config/nvim/init.vim
ln -fFns "$base_dir/.nvim/UltiSnips" ~/.config/nvim/UltiSnips
echo 'Linked Neovim configuration'
echo 'Done!'
;;
'n')
echo 'Aborted.'
;;
esac