Files
dotfiles/CLAUDE.md
T
daniil-berg 0253a46882 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>
2026-06-26 17:46:10 +02:00

2.7 KiB

My personal dotfiles

To be used with GNU stow.

Goal is a clean-as-possible home directory. As much as possible in standard .config/, .local/ and so on.

Shell architecture (multi-shell)

The config supports both zsh and bash from one branch. Pick the login shell by which package you stow; shell/ is always stowed. (There used to be a separate bashed branch — retired; do not recreate it.)

Split by role:

  • shell/ (shared) — POSIX, shell-agnostic.
    • exports, path — environment. path is idempotent (safe to source twice).
    • aliases, functions — interactive bits, POSIX-safe.
    • interactive — sources aliases/functions/extra + pyenv shims. Loaded by each shell's own rc (brace expansion OK; only zsh/bash source it).
    • profile — POSIX login env only (no brace expansion, no rc source). ~/.profile symlinks to it.
  • zsh/~/.zshenv (sets ZDOTDIR+env, runs for every zsh), $ZDOTDIR/.zshrc (interactive, sources shell/interactive), $ZDOTDIR/.zprofile (login-only, pyenv --path).
  • bash/~/.bash_profile (login → sources ~/.bashrc + pyenv --path), ~/.bashrc (sources ~/.profile for env, then ~/.config/bash/rc), ~/.config/bash/rc (interactive, sources shell/interactive + bash bits), prompt.

Invariants worth keeping:

  • ZDOTDIR belongs in ~/.zshenv only — it must be set before zsh reads any rc file, so exports is too late.
  • Env must reach non-login interactive shells: zsh gets it via .zshenv (always runs); bash gets it because .bashrc re-sources ~/.profile (idempotent). Don't move env loading out of those two spots.
  • Prompts are necessarily per-shell (%n@%M vs \u@\h); keep them split.

Known issues / TODO (next session)

Remaining from the 2026-06-26 review (zsh/bash startup items already fixed):

  1. Clean-home goal leaks:

    • psql/rc: HISTFILE ~/.psql_history-:DBNAME writes a dotfile to $HOME. Redirect under ~/.cache.
    • git/config: excludesfile = ~/.gitignore, attributesfile = ~/.gitattributes. Move to ~/.config/git/{ignore,attributes} (git reads ignore there by default).
  2. History dirs not created. HISTFILE points at $XDG_CACHE_HOME/shell/history, but zsh/bash won't mkdir the parent, so history is silently dropped. Need a bootstrap/mkdir -p. (The python startup script already does its own mkdir.)

  3. Dead config. alias f="$FILE"$FILE is never set (empty alias); functions file is empty; git/config carries macOS-only settings (trustctime, precomposeunicode, mac comments) — dead weight on Arch. bash/.config/bash/rc also keeps Homebrew/macOS completion blocks (guarded, harmless, but droppable).