From 98f809dfe59b55d9ece0043db6db5b61f9da93a7 Mon Sep 17 00:00:00 2001 From: Steve Beaulac Date: Fri, 24 Jul 2026 13:56:14 -0400 Subject: [PATCH] refactor(shell): modularize shell config into per-shell profiles and conf.d Split bash config into dedicated aliases and profile files. Extract fish shell init from config.fish into composable conf.d fragments (setup, environment, ssh-auth-sock). Remove the generic profile in favor of the bash-specific one. Add a static SSH_AUTH_SOCK symlink so tmux sessions always see the current socket regardless of which shell spawned them. --- config/bash/aliases | 9 ++++++ config/bash/profile | 36 ++++++++++++++++++++++++ config/fish/conf.d/00-setup.fish | 20 +++++++++++++ config/fish/conf.d/01-environment.fish | 11 ++++++++ config/fish/conf.d/02-ssh-auth-sock.fish | 9 ++++++ config/fish/config.fish | 24 ---------------- config/mise/config.toml | 1 + config/profile | 18 ------------ config/tmux/tmux.conf | 4 +++ 9 files changed, 90 insertions(+), 42 deletions(-) create mode 100644 config/bash/aliases create mode 100644 config/bash/profile create mode 100644 config/fish/conf.d/00-setup.fish create mode 100644 config/fish/conf.d/01-environment.fish create mode 100644 config/fish/conf.d/02-ssh-auth-sock.fish delete mode 100644 config/profile diff --git a/config/bash/aliases b/config/bash/aliases new file mode 100644 index 0000000..72b2110 --- /dev/null +++ b/config/bash/aliases @@ -0,0 +1,9 @@ +alias zero='zero.js' +alias wtc="wt switch --create --execute=$EDITOR" +alias wts="wt switch" +alias wtr="wt remove @" +alias ll="eza -l -g --icons" +alias ls="eza -al --color=always --group-directories-first" +alias g="git" +alias neogit="nvim +Neogit" + diff --git a/config/bash/profile b/config/bash/profile new file mode 100644 index 0000000..d3dda25 --- /dev/null +++ b/config/bash/profile @@ -0,0 +1,36 @@ +append_path () { + case ":$PATH:" in + *:"$1":*) + ;; + *) + PATH="${PATH:+$PATH:}$1" + esac +} + +append_path "$HOME/.local/bin" +append_path "$HOME/.cargo/bin" + +export PATH + +if [ test -x $(command -v mise) ]; then + eval "$(mise activate bash)" +fi + +if [ test -x $(command -v zoxide) ]; then + eval "$(zoxide init bash)" +fi + +if [ test -x $(command -v fzf) ]; then + eval "$(fzf --bash)" +fi + +if [ -z "$SSH_CONNECTION" ]; then + export SSH_AUTH_SOCK="/run/user/$UID/gnupg/S.gpg-agent.ssh" +fi + +# Create a predictable symlink pointing to the current SSH auth socket +auth_sock="$HOME/.ssh/ssh_auth_sock" +if [ -n "$SSH_AUTH_SOCK" ] && [ "$SSH_AUTH_SOCK" != "$auth_sock" ]; then + mkdir -p "$HOME/.ssh" + ln -sf "$SSH_AUTH_SOCK" "$auth_sock" +fi diff --git a/config/fish/conf.d/00-setup.fish b/config/fish/conf.d/00-setup.fish new file mode 100644 index 0000000..7a99c23 --- /dev/null +++ b/config/fish/conf.d/00-setup.fish @@ -0,0 +1,20 @@ +if command -q mise + mise activate fish | source +end + +if command -q direnv + direnv hook fish | source +end + +if command -q zoxide; + zoxide init fish | source +end + +if command -q fzf + fzf --fish | source +end + +if command -q jj + jj util completion fish | source +end + diff --git a/config/fish/conf.d/01-environment.fish b/config/fish/conf.d/01-environment.fish new file mode 100644 index 0000000..48a8386 --- /dev/null +++ b/config/fish/conf.d/01-environment.fish @@ -0,0 +1,11 @@ +fish_add_path "$HOME/.local/bin" +fish_add_path "$HOME/.cargo/bin" + +set -gx npm_config_prefix "$HOME/.local" + +if command -q nvim + set -gx EDITOR nvim +end + +set -gx VISUAL $EDITOR + diff --git a/config/fish/conf.d/02-ssh-auth-sock.fish b/config/fish/conf.d/02-ssh-auth-sock.fish new file mode 100644 index 0000000..b6f6ce1 --- /dev/null +++ b/config/fish/conf.d/02-ssh-auth-sock.fish @@ -0,0 +1,9 @@ +# Create a predictable symlink to the current SSH auth socket. +# tmux forces SSH_AUTH_SOCK to ~/.ssh/ssh_auth_sock globally +# (see config/tmux/tmux.conf), so this symlink must exist for every +# interactive shell -- not just bash login shells. +set -l auth_sock "$HOME/.ssh/ssh_auth_sock" +if set -q SSH_AUTH_SOCK; and test "$SSH_AUTH_SOCK" != "$auth_sock"; and test -S "$SSH_AUTH_SOCK" + mkdir -p "$HOME/.ssh" + ln -sf "$SSH_AUTH_SOCK" "$auth_sock" +end diff --git a/config/fish/config.fish b/config/fish/config.fish index 405751b..1737586 100644 --- a/config/fish/config.fish +++ b/config/fish/config.fish @@ -12,27 +12,6 @@ if status is-interactive fish_config prompt choose default fish_hybrid_key_bindings - fish_add_path "$HOME/.local/bin" - fish_add_path "$HOME/.cargo/bin" - - set -gx npm_config_prefix "$HOME/.local" - - if command -q mise - /usr/bin/mise activate fish | source - end - - if command -q direnv - /usr/bin/direnv hook fish | source - end - - if command -q zoxide - /usr/bin/zoxide init fish | source - end - - if command -q fzf - /usr/bin/fzf --fish | source - end - command -q nmcli && alias nmlist "nmcli device wifi list" if command -q tree @@ -51,7 +30,6 @@ if status is-interactive command -q zero.js && alias zero 'zero.js' if command -q nvim - set -gx EDITOR nvim alias oo "cd $SECOND_BRAIN" alias on "nvim '+Obsidian new'" alias os "nvim '+Obsidian search'" @@ -83,8 +61,6 @@ if status is-interactive command -q bat && alias cat "bat" command -q git && alias g git - set -gx VISUAL $EDITOR - if command -q jj /usr/bin/jj util completion fish | source end diff --git a/config/mise/config.toml b/config/mise/config.toml index adbaa69..c62b313 100644 --- a/config/mise/config.toml +++ b/config/mise/config.toml @@ -11,6 +11,7 @@ copilot-cli = "latest" "github:ZinoKader/portal" = "latest" "github:danielmiessler/fabric" = "latest" "github:mrusme/reader" = "latest" +"github:rimio-ai/rimz" = "latest" "github:ulyssa/iamb" = "latest" "github:zed-industries/codex-acp" = "latest" herdr = "latest" diff --git a/config/profile b/config/profile deleted file mode 100644 index 6c4445f..0000000 --- a/config/profile +++ /dev/null @@ -1,18 +0,0 @@ -append_path () { - case ":$PATH:" in - *:"$1":*) - ;; - *) - PATH="${PATH:+$PATH:}$1" - esac - } - - append_path "$HOME/.local/bin" - append_path "$HOME/.cargo/bin" - - - export PATH - - if [ -z "$SSH_CONNECTION" ]; then - export SSH_AUTH_SOCK="/run/user/$UID/gnupg/S.gpg-agent.ssh" - fi diff --git a/config/tmux/tmux.conf b/config/tmux/tmux.conf index 3eaffc0..ccd7872 100644 --- a/config/tmux/tmux.conf +++ b/config/tmux/tmux.conf @@ -18,6 +18,10 @@ set -as terminal-feature ",foot*:RGB" # allow terminal scrolling #set -g terminal-overrides 'xterm*:smcup@:rmcup@' +# Force tmux to use the static symlink path globally +setenv -g SSH_AUTH_SOCK "$HOME/.ssh/ssh_auth_sock" +set -g update-environment "DISPLAY XAUTHORITY" + # default shell set -g default-shell "/usr/bin/fish"