From 371f4c5b92596be103276bc70aeb2faaa8b6656d Mon Sep 17 00:00:00 2001 From: Rasmus Wejlgaard Date: Sat, 13 Jun 2026 13:40:34 +0100 Subject: [PATCH] fix: review fixes from dotfiles audit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - aliases: fix macOS/FreeBSD detection — `[ uname = "Darwin" ]` compared the literal string "uname" and never matched, so brew/pkg aliases never set - aliases: fix `vol` redirection order so both stdout and stderr are silenced - config.fish: drop `TERM=xterm`, which broke truecolor inside tmux - tmux: set default-terminal tmux-256color and enable truecolor passthrough - functions: confirm before `git reset --hard` in gitissue, add usage guard - install: symlink configs instead of copying so live edits flow back to repo (envvars.fish/status.conf still copied to preserve per-machine overrides); drop dead kitty mkdir - Makefile: add refresh to .PHONY - ci: bump checkout to v4, drop unused QEMU step (amd64-only on amd64 runner) --- .github/workflows/pr-test.yml | 5 +---- Makefile | 2 +- README.md | 8 +++++--- config/fish/aliases.fish | 6 +++--- config/fish/config.fish | 3 +-- config/fish/functions.fish | 12 ++++++++++++ config/tmux/scripts/bluetooth-menu.sh | 0 config/tmux/scripts/status.sh | 0 config/tmux/tmux.conf | 4 ++++ install-scripts/02-move-files.sh | 27 ++++++++++++++++----------- 10 files changed, 43 insertions(+), 24 deletions(-) mode change 100644 => 100755 config/tmux/scripts/bluetooth-menu.sh mode change 100644 => 100755 config/tmux/scripts/status.sh diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml index ea73335..e606393 100644 --- a/.github/workflows/pr-test.yml +++ b/.github/workflows/pr-test.yml @@ -17,10 +17,7 @@ jobs: - ubuntu runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 + - uses: actions/checkout@v4 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 diff --git a/Makefile b/Makefile index 0954bc9..d4367c7 100644 --- a/Makefile +++ b/Makefile @@ -12,4 +12,4 @@ refresh: @bash ./install-scripts/02-move-files.sh @exec fish -.PHONY: full-install +.PHONY: full-install refresh diff --git a/README.md b/README.md index 2f0d205..150a977 100644 --- a/README.md +++ b/README.md @@ -75,10 +75,12 @@ Installs essential packages based on your OS: - **FreeBSD**: Uses pkg ### 2. File Deployment (`02-move-files.sh`) -Copies configuration files to their proper locations: +Symlinks configuration files to their proper locations: - Creates necessary directories (`~/.config/nvim`, `~/.config/fish`, etc.) -- Copies config files to home directory -- Preserves existing `envvars.fish` if present +- Symlinks tracked config files into the home directory, so edits to the + live config flow straight back to the repo +- Copies (rather than symlinks) `envvars.fish` and `status.conf` so per-machine + customizations are preserved, and only if they don't already exist ### 3. Fisher Installation (`03-fisher-install.fish`) Installs Fisher, the Fish shell plugin manager diff --git a/config/fish/aliases.fish b/config/fish/aliases.fish index d33affe..b588d87 100644 --- a/config/fish/aliases.fish +++ b/config/fish/aliases.fish @@ -1,7 +1,7 @@ # aliases # Package manager aliases -if [ uname = "Darwin" ] +if test (uname) = "Darwin" alias get="brew install" alias search="brew search" else if [ -f /etc/arch-release ] @@ -13,7 +13,7 @@ else if [ -f /etc/lsb-release ] else if [ -f /etc/alpine-release ] alias get="apk add" alias search="apk search" -else if [ uname = "FreeBSD" ] +else if test (uname) = "FreeBSD" alias get="sudo pkg install -y" alias search="pkg search" else if [ -f /etc/gentoo-release ] @@ -40,5 +40,5 @@ end # Volume control (pipewire) function vol - wpctl set-volume @DEFAULT_SINK@ $argv% 2>&1 > /dev/null + wpctl set-volume @DEFAULT_SINK@ $argv% > /dev/null 2>&1 end diff --git a/config/fish/config.fish b/config/fish/config.fish index fcd35f1..c974d70 100644 --- a/config/fish/config.fish +++ b/config/fish/config.fish @@ -1,3 +1,2 @@ export fish_greeting="" # Silence welcome message -export EDITOR=nvim -export TERM=xterm \ No newline at end of file +export EDITOR=nvim \ No newline at end of file diff --git a/config/fish/functions.fish b/config/fish/functions.fish index 41626ba..76e1a33 100644 --- a/config/fish/functions.fish +++ b/config/fish/functions.fish @@ -12,6 +12,18 @@ end # update master and create a branch with value: $1 function gitissue + if test -z "$argv[1]" + echo "usage: gitissue " + return 1 + end + # `git reset --hard` discards uncommitted work, so confirm first. + if not git diff --quiet; or not git diff --cached --quiet + read -P "Uncommitted changes will be DISCARDED. Continue? [y/N] " -n 1 reply + if test "$reply" != y -a "$reply" != Y + echo "Aborted." + return 1 + end + end git reset --hard git checkout master git pull origin master diff --git a/config/tmux/scripts/bluetooth-menu.sh b/config/tmux/scripts/bluetooth-menu.sh old mode 100644 new mode 100755 diff --git a/config/tmux/scripts/status.sh b/config/tmux/scripts/status.sh old mode 100644 new mode 100755 diff --git a/config/tmux/tmux.conf b/config/tmux/tmux.conf index d4abb70..1e0804e 100644 --- a/config/tmux/tmux.conf +++ b/config/tmux/tmux.conf @@ -20,6 +20,10 @@ bind -n M-\} swap-pane -D set -g mouse on +# Use a 256-color terminal and enable truecolor passthrough +set -g default-terminal "tmux-256color" +set -ga terminal-overrides ",*256col*:Tc" + set-option -g allow-rename off set -g base-index 1 diff --git a/install-scripts/02-move-files.sh b/install-scripts/02-move-files.sh index f32945a..3c5103f 100755 --- a/install-scripts/02-move-files.sh +++ b/install-scripts/02-move-files.sh @@ -1,32 +1,37 @@ #!/bin/bash set -e # exit on error +# Symlink tracked config files into place so edits to the live config flow +# straight back to the repo (no more "tweaked it and lost it on refresh"). +# Resolve the repo root so this works regardless of where it's invoked from. +REPO="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" + # create directories mkdir -p ~/.config/nvim mkdir -p ~/.config/fish mkdir -p ~/.config/fish/conf.d -mkdir -p ~/.config/kitty # vim -cp config/vim/init.lua ~/.config/nvim/ +ln -sf "$REPO/config/vim/init.lua" ~/.config/nvim/init.lua # fish -cp config/fish/config.fish ~/.config/fish/ -cp config/fish/aliases.fish ~/.config/fish/conf.d/ -cp config/fish/functions.fish ~/.config/fish/conf.d/ +ln -sf "$REPO/config/fish/config.fish" ~/.config/fish/config.fish +ln -sf "$REPO/config/fish/aliases.fish" ~/.config/fish/conf.d/aliases.fish +ln -sf "$REPO/config/fish/functions.fish" ~/.config/fish/conf.d/functions.fish # Only copy envvars.fish if it doesn't exist. -# This way we can override it with our own configs. +# This way we can override it with our own per-machine config. if [ ! -f ~/.config/fish/conf.d/envvars.fish ]; then - cp config/fish/envvars.fish ~/.config/fish/conf.d/ + cp "$REPO/config/fish/envvars.fish" ~/.config/fish/conf.d/ fi # tmux -cp config/tmux/tmux.conf ~/.tmux.conf +ln -sf "$REPO/config/tmux/tmux.conf" ~/.tmux.conf mkdir -p ~/.tmux/scripts -cp config/tmux/scripts/*.sh ~/.tmux/scripts/ -chmod +x ~/.tmux/scripts/*.sh +for script in "$REPO"/config/tmux/scripts/*.sh; do + ln -sf "$script" ~/.tmux/scripts/ +done # only copy status.conf if it doesn't exist, so local customizations are preserved if [ ! -f ~/.tmux/scripts/status.conf ]; then - cp config/tmux/scripts/status.conf ~/.tmux/scripts/ + cp "$REPO/config/tmux/scripts/status.conf" ~/.tmux/scripts/ fi