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.
This commit is contained in:
@@ -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"
|
||||||
|
|
||||||
@@ -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
|
||||||
@@ -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
|
||||||
|
|
||||||
@@ -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
|
||||||
|
|
||||||
@@ -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
|
||||||
@@ -12,27 +12,6 @@ if status is-interactive
|
|||||||
fish_config prompt choose default
|
fish_config prompt choose default
|
||||||
fish_hybrid_key_bindings
|
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"
|
command -q nmcli && alias nmlist "nmcli device wifi list"
|
||||||
|
|
||||||
if command -q tree
|
if command -q tree
|
||||||
@@ -51,7 +30,6 @@ if status is-interactive
|
|||||||
command -q zero.js && alias zero 'zero.js'
|
command -q zero.js && alias zero 'zero.js'
|
||||||
|
|
||||||
if command -q nvim
|
if command -q nvim
|
||||||
set -gx EDITOR nvim
|
|
||||||
alias oo "cd $SECOND_BRAIN"
|
alias oo "cd $SECOND_BRAIN"
|
||||||
alias on "nvim '+Obsidian new'"
|
alias on "nvim '+Obsidian new'"
|
||||||
alias os "nvim '+Obsidian search'"
|
alias os "nvim '+Obsidian search'"
|
||||||
@@ -83,8 +61,6 @@ if status is-interactive
|
|||||||
command -q bat && alias cat "bat"
|
command -q bat && alias cat "bat"
|
||||||
command -q git && alias g git
|
command -q git && alias g git
|
||||||
|
|
||||||
set -gx VISUAL $EDITOR
|
|
||||||
|
|
||||||
if command -q jj
|
if command -q jj
|
||||||
/usr/bin/jj util completion fish | source
|
/usr/bin/jj util completion fish | source
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ copilot-cli = "latest"
|
|||||||
"github:ZinoKader/portal" = "latest"
|
"github:ZinoKader/portal" = "latest"
|
||||||
"github:danielmiessler/fabric" = "latest"
|
"github:danielmiessler/fabric" = "latest"
|
||||||
"github:mrusme/reader" = "latest"
|
"github:mrusme/reader" = "latest"
|
||||||
|
"github:rimio-ai/rimz" = "latest"
|
||||||
"github:ulyssa/iamb" = "latest"
|
"github:ulyssa/iamb" = "latest"
|
||||||
"github:zed-industries/codex-acp" = "latest"
|
"github:zed-industries/codex-acp" = "latest"
|
||||||
herdr = "latest"
|
herdr = "latest"
|
||||||
|
|||||||
@@ -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
|
|
||||||
@@ -18,6 +18,10 @@ set -as terminal-feature ",foot*:RGB"
|
|||||||
# allow terminal scrolling
|
# allow terminal scrolling
|
||||||
#set -g terminal-overrides 'xterm*:smcup@:rmcup@'
|
#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
|
# default shell
|
||||||
set -g default-shell "/usr/bin/fish"
|
set -g default-shell "/usr/bin/fish"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user