Files
config/zsh/zshrc-osx
T
Bastien CHANOT 3b53213af4 feat(shell): export identity as USER/EMAIL instead of VIUSER/VIMAIL
Same names in bashrc-linux, bashrc-osx and zshrc-osx, so the vim header
and the rendered ~/.gitconfig share one identity.
2026-10-06 10:55:14 +02:00

68 lines
2.2 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'
# 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 the vim header; install.sh also writes it into ~/.gitconfig
export USER=bchanot
export EMAIL=bchanot@gmail.fr
# 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