# Managed by dotfiles/zsh/install.sh — edits made directly to ~/.zshrc will be
# overwritten on the next bootstrap run. Edit zsh/zshrc in the dotfiles repo
# instead.

# If this account was added to the docker group (dotfiles/docker/install.sh)
# but this shell's session predates that, re-exec via newgrp so docker works
# without a full logout. Guarded: fires only when the group is on the account
# yet missing from the running shell's groups, so the newgrp'd shell (which
# has the group) cannot loop.
# Only for real terminals ([ -t 0 ]): newgrp replaces the shell and would
# swallow the command in scripted `zsh -i -c ...` invocations.
if [ -t 0 ] && [ -S /var/run/docker.sock ] \
   && id -nG "${USER:-$(id -un)}" 2>/dev/null | grep -qw docker \
   && ! id -Gn 2>/dev/null | grep -qw docker; then
  exec newgrp docker
fi

# Userland tools installed by dotfiles/bin/install.sh live here.
case ":$PATH:" in
  *":$HOME/.local/bin:"*) ;;
  *) export PATH="$HOME/.local/bin:$PATH" ;;
esac

export ZSH="$HOME/.oh-my-zsh"

ZSH_THEME="robbyrussell"

plugins=(git)

source "$ZSH/oh-my-zsh.sh"

HISTSIZE=10000
SAVEHIST=10000
setopt SHARE_HISTORY
setopt HIST_IGNORE_DUPS

# Per-machine customizations (secrets, keys, local overrides) live in
# ~/.zshrc.local, which bootstrap never touches. See zsh/zshrc.local.example
# for the variables modules look for. Loaded last so it can override anything.
[ -f "$HOME/.zshrc.local" ] && source "$HOME/.zshrc.local"
