-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·94 lines (76 loc) · 2.54 KB
/
install.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
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/bin/bash
set -eufo pipefail
IFS=$'\n\t'
# If you don't pass a second argument, the first argument is symlinked into
# `$XDG_CONFIG_HOME`.
symlink() {
SRC="$dotfiles_dir/$1"
[ -e "$SRC" ] || (echo "No file named $SRC" && exit 1)
DEST="${2:-$XDG_CONFIG_HOME/$1}"
ln -svfFn "$SRC" "$DEST"
}
pushd "$HOME/dotfiles" >/dev/null
dotfiles_dir=$(git rev-parse --show-toplevel)
# If this is running for the first time, these variables won't be set.
set +u
source env/xdg.sh
set -u
# Ensure the primary XDG directories exist
mkdir -p "$XDG_CACHE_HOME" "$XDG_CONFIG_HOME" "$XDG_DATA_HOME"
# Set up directory with environment variables
symlink env
symlink sh
# Set up ZSH
symlink zsh
# .zshenv needs to be in $HOME to bootstrap ZDOTDIR
ln -svfn "$XDG_CONFIG_HOME/zsh/zshenv" ~/.zshenv
mkdir -p "$XDG_CACHE_HOME/zsh"
mkdir -p "$XDG_DATA_HOME/zsh"
symlink alacritty
symlink brewfile
symlink broot
symlink direnv
symlink gh
symlink git
symlink gnupg
symlink krew
symlink mise
symlink pipx
symlink pypoetry
symlink tmux
symlink vim
symlink _jsbeautifyrc ~/.jsbeautifyrc
symlink _pythonstartup ~/.pythonstartup
symlink starship.toml ~/.config/starship.toml
# Joplin does not respect XDG_CONFIG_HOME, and puts both data and cache data in
# the hard-coded `~/.config/joplin-desktop/` directory.
# https://github.com/laurent22/joplin/issues/6524
joplin_dir="$HOME/.config/joplin-desktop"
mkdir -p "$joplin_dir"
symlink joplin-desktop/userchrome.css "$joplin_dir/userchrome.css"
symlink joplin-desktop/userstyle.css "$joplin_dir/userstyle.css"
# TODO: Make this work outside of macOS
vscode_settings_dir="$HOME/Library/Application Support/Code/User"
mkdir -p "$vscode_settings_dir"
symlink VSCode/keybindings.json "$vscode_settings_dir/keybindings.json"
symlink VSCode/settings.json "$vscode_settings_dir/settings.json"
symlink VSCode/tasks.json "$vscode_settings_dir/tasks.json"
# TODO: Make this work outside of macOS
symlink espanso "$HOME/Library/Preferences"
if [ -e "$HOME/.bashrc" ] && grep -q 'source ~/dotfiles/_bashrc' "$HOME/.bashrc"; then
echo ".bashrc has already been modified"
else
echo "Updating .bashrc"
echo 'source ~/dotfiles/_bashrc' >>"$HOME/.bashrc"
fi
# Symlink all virtualenvwrapper hooks
set +f
for f in virtualenvwrapper/*; do
# TODO: Handle first time install (before this is defined) better
[[ -z "${WORKON_HOME:-}" ]] || symlink "$f" "$WORKON_HOME"
done
set -f
launch_agents="$HOME/Library/LaunchAgents"
mkdir -p "$launch_agents"
symlink macos/com.local.KeyRemapping.plist "$launch_agents/com.local.KeyRemapping.plist"
popd >/dev/null