if status is-login
    replay "source /etc/profile"
    umask {{ umask }}
    for path in $XDG_BIN_HOME $GOPATH/bin $CARGO_HOME/bin $PNPM_HOME/bin $KREW_ROOT/bin $XDG_DATA_HOME/luarocks/bin
        test -d $path; and set -ga fish_user_paths $path
    end
end

# Starship prompt
if command -v starship > /dev/null
  starship init fish --print-full-init | source
end

# zoxide
if command -v zoxide >/dev/null
  zoxide init fish | source
end

# load opam switch env vars
if command -v opam >/dev/null
  opam env | source
end

# gpg-agent
set -gx GPG_TTY (tty)

{% if ssh_client == 'openssh' %}
# gpg-agent normally starts on demand but ssh command doesn't trigger it
# As such manually start it on login
status is-login; and gpgconf --launch gpg-agent
gpg-connect-agent updatestartuptty /bye >/dev/null
if test -z "$SSH_AUTH_SOCK"
  set -gx SSH_AUTH_SOCK (gpgconf --list-dirs agent-ssh-socket)
end
{% endif %}
