Files
config/zsh/zshrc-osx
T
bchanot 8f6969001f feat(identity): ask name/email at install, no hardcoded USER/EMAIL in the repo
- rc templates carry @USER@/@EMAIL@ placeholders; install.sh renders them
- resolve_identity: an export already in ~/.bashrc or ~/.zshrc is reused silently,
  else IDENTITY_USER/IDENTITY_EMAIL, else a prompt, else login name + empty email
- render_gitconfig generalised to render_identity_template (gitconfig unchanged)
- vimrc reads g:_author/g:_email from $USER/$EMAIL instead of hardcoded values
- README + CLAUDE.md
2026-10-06 15:34:11 +02:00

72 lines
2.4 KiB
Plaintext

# zshrc for macOS: zsh + oh-my-zsh counterpart of bash/bashrc-osx (same env,
# aliases and dtach menu; the prompt lives in bchanot.zsh-theme).
# Machine-specific lines (nvm, bun, tokens...) go in ~/.zshrc.local, never here.
# Homebrew on PATH (Apple Silicon: /opt/homebrew, Intel: /usr/local).
for brew_bin in /opt/homebrew/bin/brew /usr/local/bin/brew; do
if [ -x "$brew_bin" ]; then
eval "$("$brew_bin" shellenv)"
break
fi
done
unset brew_bin
## oh-my-zsh (loaded first: the aliases below override its defaults, e.g. `d`)
export ZSH="$HOME/.oh-my-zsh"
ZSH_THEME="bchanot"
plugins=(git)
source "$ZSH/oh-my-zsh.sh"
## Enable color support of ls and also add handy aliases
# Some colors (BSD ls: -G instead of GNU --color)
alias ls='ls -G'
alias grep='grep --color=auto'
## Some export
# colored GCC warnings and errors
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
# XDG cache dir: tmux.conf saves resurrect/continuum sessions under it
export XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}"
# Ensure ~/.local/bin is on PATH (pipx CLIs + personal scripts from bin/)
case ":$PATH:" in
*":$HOME/.local/bin:"*) ;;
*) export PATH="$HOME/.local/bin:$PATH" ;;
esac
# History: none for root, near-unlimited otherwise (zsh has no -1 = unlimited).
if [[ $EUID == 0 ]] ; then
HISTSIZE=0
SAVEHIST=0
else
HISTSIZE=10000000
SAVEHIST=10000000
fi
# Identity for git commits and vim headers. Filled by install.sh (asked once,
# reused from an existing ~/.bashrc / ~/.zshrc on re-runs), never stored here.
export USER="@USER@"
export EMAIL="@EMAIL@"
# claude-dans-dtach : creer une session (claude tournant dans dtach, detache via Ctrl-\).
# Usage : cd ~/projets/seo && cc seo -> session nommee "seo".
# Pas de systemd sur macOS : dtach est lance directement (pas de slice cgroup).
dtach_claude() {
local name="${1:-claude-$(date +%H%M%S)}"
mkdir -p "$HOME/.dtach"
dtach -c "$HOME/.dtach/${name}" -e '^\' \
bash -c 'set -a; [ -f "$HOME/.claude/.env" ] && . "$HOME/.claude/.env"; set +a; exec claude'
}
alias cc='dtach_claude'
# Rappeler a la demande le menu de reprise.
alias d='source ~/.local/bin/dtach-router'
# Reglages propres a cette machine (non versionnes).
[ -f "$HOME/.zshrc.local" ] && source "$HOME/.zshrc.local"
# Au demarrage d'un shell interactif, proposer de reprendre une session dtach existante
# (silencieux si aucune).
case $- in *i*) [ -x "$HOME/.local/bin/dtach-router" ] && . "$HOME/.local/bin/dtach-router" ;; esac