unify zsh+bash shell config; fix zsh startup

Support either shell as the login shell via stow selection (merges the
bashed branch in). shell/ holds shared POSIX env + interactive config;
each shell loads its own rc natively.

- zsh: add .zshenv (sets ZDOTDIR+env early), rename rc -> .zshrc, add
  login-only .zprofile (pyenv --path)
- bash: add ~/.bash_profile + ~/.bashrc stubs, .config/bash/{rc,prompt}
- shell: profile is POSIX env-only (no zsh-rc source); path rewritten
  POSIX + idempotent (flat ~/.local/bin, no subdir recursion); new
  interactive sources aliases/functions + pyenv shims
- drop dead shell/.zprofile symlink; move ZDOTDIR out of exports

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-26 17:46:10 +02:00
parent a6a3d3a759
commit 9262c9795a
12 changed files with 236 additions and 20 deletions
+2 -2
View File
@@ -33,5 +33,5 @@ export PYTHON_HISTFILE="${XDG_CACHE_HOME:-$HOME/.cache}/python/history"
# Wget config file
export WGETRC="${XDG_CONFIG_HOME:-$HOME/.config}/wget/rc"
# ZSH directory
export ZDOTDIR="${XDG_CONFIG_HOME:-$HOME/.config}/zsh"
# NOTE: ZDOTDIR lives in ~/.zshenv, not here. It must be set before zsh reads
# any rc file, and this file is sourced too late for that.
+12
View File
@@ -0,0 +1,12 @@
#!/bin/sh
# Shared interactive shell config. Sourced by both zsh ($ZDOTDIR/.zshrc) and
# bash (~/.config/bash/rc). Only ever loaded by zsh/bash, so brace expansion is
# fine here (unlike the POSIX `profile`).
for _file in "${XDG_CONFIG_HOME:-$HOME/.config}"/shell/{aliases,functions,extra}; do
[ -r "$_file" ] && . "$_file"
done
unset _file
# pyenv interactive shims (pyenv init - autodetects the running shell):
command -v pyenv >/dev/null 2>&1 && eval "$(pyenv init -)"
+6 -2
View File
@@ -1,4 +1,8 @@
#!/bin/sh
# Adds `~/.local/bin` to $PATH
export PATH="$PATH:${$(find ~/.local/bin -type d -printf %p:)%%:}"
# Prepend ~/.local/bin to $PATH (POSIX, idempotent — safe to source twice).
case ":$PATH:" in
*":$HOME/.local/bin:"*) ;;
*) [ -d "$HOME/.local/bin" ] && PATH="$HOME/.local/bin:$PATH" ;;
esac
export PATH
+11 -15
View File
@@ -1,17 +1,13 @@
#!/bin/sh
# Load the shell dotfiles, and then some:
# * ~/.path can be used to extend `$PATH`.
# * ~/.extra can be used for other settings you dont want to commit.
for file in ~/.config/shell/{path,exports,aliases,functions,extra}; do
[ -r "$file" ] && [ -f "$file" ] && source "$file";
done;
unset file;
source ~/.config/zsh/rc
# Setup pyenv, if it is installed:
if [ -x "$(command -v pyenv)" ]; then
eval "$(pyenv init --path)"
eval "$(pyenv init -)"
fi
# POSIX login environment. Sourced directly by a /bin/sh login (display
# managers, plain sh) and indirectly by bash via ~/.bashrc. Env only — no
# brace expansion (dash doesn't expand it), no shell-specific rc.
#
# Interactive config (aliases, functions, prompt) is loaded by each shell's
# own rc via ~/.config/shell/interactive, not here.
for _name in path exports; do
_file="${XDG_CONFIG_HOME:-$HOME/.config}/shell/$_name"
[ -r "$_file" ] && . "$_file"
done
unset _name _file