-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·42 lines (36 loc) · 1.81 KB
/
Copy pathsetup.sh
File metadata and controls
executable file
·42 lines (36 loc) · 1.81 KB
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
#!/bin/bash
# symlink dotfiles
dir="$HOME/dotfiles"
olddir="$HOME/dotfiles/bak" # backup directory
files=".zshrc .zshrc.d .rc.d .bashrc .vimrc .bash_logout .gitconfig .gitignore_global .gemrc .vim .tmux.conf CLAUDE.md" # list of files/folders to symlink in homedir
## create dotfiles_old in homedir
mkdir -p $olddir
## move any existing dotfiles in homedir to dotfiles_old directory, then create symlinks
for file in $files; do
[ -e "$HOME/$file" ] && mv -f "$HOME/$file" $olddir
echo "Creating symlink to $file in ~"
ln -sfn "$dir/$file" "$HOME/$file"
done
# ── App settings ─────────────────────────────────────────────────────────────
# Symlink vetted, public-safe app configs from config/ into their real homes.
# (See .gitignore — config/ is ignored by default, these files are opted in.)
link_config() { # link_config <repo-path> <abs-dest>
local src="$dir/$1" dest="$2"
[ -e "$src" ] || return 0
mkdir -p "$(dirname "$dest")"
if [ -e "$dest" ] && [ ! -L "$dest" ]; then
mkdir -p "$olddir/$(dirname "$1")"
mv -f "$dest" "$olddir/$1"
fi
ln -sfn "$src" "$dest"
echo "Linked $1 -> $dest"
}
link_config config/bat/config "$HOME/.config/bat/config"
link_config config/ghostty/config "$HOME/.config/ghostty/config"
link_config config/zed/settings.json "$HOME/.config/zed/settings.json"
link_config config/zed/keymap.json "$HOME/.config/zed/keymap.json"
link_config config/zed/tasks.json "$HOME/.config/zed/tasks.json"
# Rectangle: prefs domain can't be symlinked — import the cleaned export instead.
if command -v defaults >/dev/null 2>&1 && [ -f "$dir/config/rectangle/import.sh" ]; then
bash "$dir/config/rectangle/import.sh" || true
fi