source "${ZDOTDIR:-$HOME}/.zsh/lib/startup.zsh" [[ -d ${ZDOTDIR:-$HOME}/.cache/zsh ]] || mkdir -p ${ZDOTDIR:-$HOME}/.cache/zsh # May ask for the key passphrase (once per boot), so it precedes instant prompt. _in_coding_agent="$CLAUDECODE$CODEX_SESSION_ID$PI_CODING_AGENT" if [[ -f ~/.ssh/sudo_key && -z $_in_coding_agent ]] && _zsh_cached sudo_key.fp ~/.ssh/sudo_key -- ssh-keygen -lf ~/.ssh/sudo_key; then read -r _ _sudo_fp _ < $REPLY [[ -e /tmp/sudo-agent.sock ]] || ssh-agent -a /tmp/sudo-agent.sock &>/dev/null SSH_AUTH_SOCK=/tmp/sudo-agent.sock ssh-add -l | grep -q "$_sudo_fp" || SSH_AUTH_SOCK=/tmp/sudo-agent.sock ssh-add ~/.ssh/sudo_key # agent forwarded by coding agents (see ~/.ssh/config): every signature, # i.e. every remote sudo, needs confirmation via askpass [[ -e /tmp/sudo-agent-confirm.sock ]] || SSH_ASKPASS=~/.ssh/askpass-agent-confirm.sh SSH_ASKPASS_REQUIRE=force \ ssh-agent -a /tmp/sudo-agent-confirm.sock &>/dev/null SSH_AUTH_SOCK=/tmp/sudo-agent-confirm.sock ssh-add -l | grep -q "$_sudo_fp" || SSH_AUTH_SOCK=/tmp/sudo-agent-confirm.sock ssh-add -c ~/.ssh/sudo_key unset _sudo_fp fi _zst_mark sudo-agent # Powerlevel10k instant prompt; nothing below may need console input. if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" fi _zst_mark instant-prompt # Machine-local layers. [[ -f ~/.zsh/.powerline_config ]] && source ~/.zsh/.powerline_config [[ -f ~/.zsh/.user_config ]] && source ~/.zsh/.user_config [[ -f ~/.zsh/.virtual_env_config.zsh ]] && source ~/.zsh/.virtual_env_config.zsh [[ -f ~/.zsh/.local_config ]] && source ~/.zsh/.local_config [[ -f ~/.zsh/.env.local ]] && source ~/.zsh/.env.local _zst_mark layers source "${ZDOTDIR:-$HOME}/.zsh/lib/updates.zsh" export LC_OSC52=1 _zst_mark updates # Completions for tools installed under ~/.local (e.g. tools-repo's safe* # wrappers). Must precede antidote, whose completion plugin runs compinit. fpath=("$HOME/.local/share/zsh/site-functions" $fpath) plugins_txt=${ZDOTDIR:-$HOME}/.zsh/.zsh_plugins.txt static_file=${ZDOTDIR:-$HOME}/.cache/zsh/.zsh_plugins.zsh source "${ZDOTDIR:-$HOME}/.zsh/lib/antidote.zsh" _zst_mark antidote source "${ZDOTDIR:-$HOME}/.zsh/lib/interactive.zsh" bindkey '^w' kill-region bindkey -v VI_MODE_SET_CURSOR=true # fzf keys (Ctrl-R/Ctrl-T/Alt-C, **); after bindkey -v so vi keymaps get them (( $+commands[fzf] )) && _zsh_cached fzf.zsh ${commands[fzf]:A} -- fzf --zsh && source $REPLY _zst_mark fzf [[ -f ~/.zsh/.mac_config.zsh ]] && source ~/.zsh/.mac_config.zsh _zst_mark mac-config # deps: go binary and `go env -w` files (macOS, Linux) if (( $+commands[go] )) && _zsh_cached gopath ${commands[go]:A} \ "$HOME/Library/Application Support/go/env" "${XDG_CONFIG_HOME:-$HOME/.config}/go/env" \ -- env -u GOPATH go env GOPATH; then [[ -n $GOPATH ]] || read -r GOPATH < $REPLY export GOPATH path+=("$GOPATH/bin") fi _zst_mark go # Use safe wrappers after ~/.local/bin has been added to PATH. # Agent shells: