find_ssh_agent () {
# setopt extendedglob
ssh-add -l &>/dev/null && return
for SSH_AUTH_SOCK in /tmp/ssh-*/agent.*(N); do
SSH_AGENT_PID=${SSH_AUTH_SOCK%*agent.}
export SSH_AUTH_SOCK SSH_AGENT_PID
ssh-add -l &>/dev/null && return
done
eval "$(keychain -Q -q --eval --agents ssh)"
}