-
Notifications
You must be signed in to change notification settings - Fork 5
/
bootstrap
executable file
·76 lines (59 loc) · 1.63 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
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$SCRIPT_DIR"
# Darwin/Linux
UNAME_S=$(uname -s)
git submodule update --init --recursive
for fname in "$SCRIPT_DIR"/.*; do
[[ ! -f $fname ]] && continue # Skip missing files
fname_base=$(basename "$fname")
fname_src="$fname"
fname_target="$HOME/$fname_base"
# Handle os-specific config files
if [[ -f "$fname.$UNAME_S" ]]; then
fname_src="$fname.$UNAME_S"
fi
ln -sfn "$fname_src" "$fname_target"
done
# Bash-completion
mkdir -p "$HOME/.local/share/"
rm -f "$HOME/.local/share/bash-completion"
ln -sfn "$SCRIPT_DIR/.local/share/bash-completion" "$HOME/.local/share/"
# For neovim
mkdir -p "$HOME"/.config
ln -sfn "$SCRIPT_DIR"/vim "$HOME"/.config/nvim
ln -sfn "$SCRIPT_DIR"/.vimrc "$HOME"/.config/nvim/init.vim
# Config dir
mkdir -p "$HOME/.config"
for d in "$SCRIPT_DIR"/config/*; do
base_dir=$(basename "$d")
if [[ -d "$HOME/.config/$base_dir" ]]; then
echo "Skipping $base_dir, already exists"
continue
fi
ln -vsfn "$d" "$HOME/.config/"
done
config_dirs=(
.ctags.d
.ipython
)
for config_dir in "${config_dirs[@]}"; do
ln -sfn "$SCRIPT_DIR/$config_dir" "$HOME/$config_dir"
done
# Binaries
mkdir -p "$HOME"/bin
ln -sfn "$SCRIPT_DIR"/bin/* "$HOME"/bin/
for binfile in "${SCRIPT_DIR}/${UNAME_S}"/bin/*; do
[[ ! -f "$binfile" ]] && continue
ln -sfn "$binfile" "$HOME"/bin/"$(basename "$binfile")"
done
# Vim dir
rm -f "$HOME"/.vim
ln -sfn "$SCRIPT_DIR"/vim "$HOME"/.vim
# Vim plugins
nvim +PlugInstall! +qall
# Vim Remote plugins
nvim +UpdateRemotePlugins +qall
"$SCRIPT_DIR/install-helpers"