feat: manage bat and Claude Code configs; add --unlink mode

- 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>
This commit is contained in:
Brian Pooe 2026-07-06 21:17:37 +02:00
parent 6861ff1e16
commit c3cd129478
5 changed files with 62 additions and 11 deletions

7
.claude/settings.json Normal file
View file

@ -0,0 +1,7 @@
{
"effortLevel": "medium",
"tui": "fullscreen",
"skipDangerousModePermissionPrompt": true,
"theme": "dark",
"model": "claude-fable-5[1m]"
}

5
.config/bat/config Normal file
View file

@ -0,0 +1,5 @@
# Follow the terminal's ANSI palette so bat matches the active Kanagawa
# variant instead of shipping its own colorscheme.
--theme="ansi"
--style="numbers,changes,header"
--italic-text=always

5
.gitignore vendored
View file

@ -16,6 +16,7 @@ nvim.log
# Track only the managed application configurations. # Track only the managed application configurations.
.config/* .config/*
!.config/bat/
!.config/nvim/ !.config/nvim/
!.config/lazygit/ !.config/lazygit/
!.config/starship/ !.config/starship/
@ -34,3 +35,7 @@ nvim.log
# Track only the ssh client config — never keys or anything else. # Track only the ssh client config — never keys or anything else.
.ssh/* .ssh/*
!.ssh/config !.ssh/config
# Track only Claude Code settings — never history, sessions, or caches.
.claude/*
!.claude/settings.json

View file

@ -15,6 +15,7 @@
# install/install.sh Full install # install/install.sh Full install
# install/install.sh --packages-only Only packages/tools (apt + brew) # install/install.sh --packages-only Only packages/tools (apt + brew)
# install/install.sh --dotfiles-only Only link dotfiles + tpm/nvm + chsh # install/install.sh --dotfiles-only Only link dotfiles + tpm/nvm + chsh
# install/install.sh --unlink Remove symlinks pointing into this repo
# install/install.sh --help # install/install.sh --help
set -eEo pipefail set -eEo pipefail
@ -28,7 +29,7 @@ source "$SCRIPT_DIR/lib/fonts.sh"
source "$SCRIPT_DIR/lib/dotfiles.sh" source "$SCRIPT_DIR/lib/dotfiles.sh"
usage() { usage() {
sed -n '2,18p' "${BASH_SOURCE[0]}" | sed 's/^# \{0,1\}//' sed -n '2,19p' "${BASH_SOURCE[0]}" | sed 's/^# \{0,1\}//'
} }
MODE=all MODE=all
@ -36,6 +37,7 @@ for arg in "$@"; do
case $arg in case $arg in
--packages-only) MODE=packages ;; --packages-only) MODE=packages ;;
--dotfiles-only) MODE=dotfiles ;; --dotfiles-only) MODE=dotfiles ;;
--unlink) MODE="unlink" ;;
-h | --help) -h | --help)
usage usage
exit 0 exit 0
@ -53,6 +55,12 @@ preflight() {
} }
main() { main() {
# Unlinking only removes symlinks; skip preflight and the closing hints.
if [[ $MODE == unlink ]]; then
unlink_dotfiles
return
fi
preflight preflight
case $MODE in case $MODE in

View file

@ -1,20 +1,46 @@
#!/bin/bash #!/bin/bash
# Symlink the dotfiles into ~ and ~/.config; switch login shell to zsh. # 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() { link_dotfiles() {
info "Linking dotfiles from $DOTFILES_DIR..." info "Linking dotfiles from $DOTFILES_DIR..."
backup_and_link "$DOTFILES_DIR/.config/nvim" "$HOME/.config/nvim"
backup_and_link "$DOTFILES_DIR/.config/tmux" "$HOME/.config/tmux"
backup_and_link "$DOTFILES_DIR/.config/starship" "$HOME/.config/starship"
backup_and_link "$DOTFILES_DIR/.config/lazygit" "$HOME/.config/lazygit"
backup_and_link "$DOTFILES_DIR/.config/wezterm" "$HOME/.config/wezterm"
backup_and_link "$DOTFILES_DIR/.config/.ideavimrc" "$HOME/.ideavimrc"
backup_and_link "$DOTFILES_DIR/.zshrc" "$HOME/.zshrc"
backup_and_link "$DOTFILES_DIR/.gitconfig" "$HOME/.gitconfig"
mkdir -p "$HOME/.ssh" mkdir -p "$HOME/.ssh"
chmod 700 "$HOME/.ssh" chmod 700 "$HOME/.ssh"
backup_and_link "$DOTFILES_DIR/.ssh/config" "$HOME/.ssh/config" local entry
backup_and_link "$DOTFILES_DIR/bin/dotfiles-apply-theme" "$HOME/.local/bin/dotfiles-apply-theme" 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() { set_zsh_as_shell() {