- New managed configs: .config/bat (ANSI theme so bat follows the terminal palette) and .claude/settings.json, with a .gitignore guard so only settings.json under .claude/ is trackable. - dotfiles.sh: drive linking from a single link map and add unlink_dotfiles; install.sh grows --unlink to cleanly remove every symlink pointing into the repo. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
59 lines
1.7 KiB
Bash
59 lines
1.7 KiB
Bash
#!/bin/bash
|
|
# Symlink the dotfiles into ~ and ~/.config; switch login shell to zsh.
|
|
|
|
# Each entry: "<repo-relative source>|<absolute destination>".
|
|
# Drives both link_dotfiles and unlink_dotfiles — add new links here.
|
|
dotfile_links() {
|
|
cat <<EOF
|
|
.config/nvim|$HOME/.config/nvim
|
|
.config/tmux|$HOME/.config/tmux
|
|
.config/starship|$HOME/.config/starship
|
|
.config/lazygit|$HOME/.config/lazygit
|
|
.config/wezterm|$HOME/.config/wezterm
|
|
.config/bat|$HOME/.config/bat
|
|
.config/.ideavimrc|$HOME/.ideavimrc
|
|
.zshrc|$HOME/.zshrc
|
|
.gitconfig|$HOME/.gitconfig
|
|
.ssh/config|$HOME/.ssh/config
|
|
.claude/settings.json|$HOME/.claude/settings.json
|
|
bin/dotfiles-apply-theme|$HOME/.local/bin/dotfiles-apply-theme
|
|
EOF
|
|
}
|
|
|
|
link_dotfiles() {
|
|
info "Linking dotfiles from $DOTFILES_DIR..."
|
|
mkdir -p "$HOME/.ssh"
|
|
chmod 700 "$HOME/.ssh"
|
|
local entry
|
|
while IFS= read -r entry; do
|
|
backup_and_link "$DOTFILES_DIR/${entry%%|*}" "${entry#*|}"
|
|
done < <(dotfile_links)
|
|
}
|
|
|
|
unlink_dotfiles() {
|
|
info "Removing symlinks that point into $DOTFILES_DIR..."
|
|
local entry dest
|
|
while IFS= read -r entry; do
|
|
dest="${entry#*|}"
|
|
if [[ -L $dest && $(readlink "$dest") == "$DOTFILES_DIR"/* ]]; then
|
|
rm "$dest"
|
|
info "Unlinked $dest"
|
|
fi
|
|
done < <(dotfile_links)
|
|
info "Any .pre-install.* backups were left in place; restore them manually."
|
|
}
|
|
|
|
set_zsh_as_shell() {
|
|
local zsh_bin
|
|
zsh_bin="$(command -v zsh || true)"
|
|
[[ -n $zsh_bin ]] || {
|
|
warn "zsh not installed; skipping chsh"
|
|
return
|
|
}
|
|
if [[ $SHELL == "$zsh_bin" ]]; then
|
|
info "Login shell is already zsh"
|
|
return
|
|
fi
|
|
info "Changing login shell to $zsh_bin..."
|
|
sudo chsh -s "$zsh_bin" "$USER" || warn "chsh failed; run 'chsh -s $zsh_bin' manually"
|
|
}
|