1 (( $+commands[keychain] )) || return
3 # Define SHORT_HOST if not defined (%m = host name up to first .)
4 SHORT_HOST=${SHORT_HOST:-${(%):-%m}}
10 local _keychain_env_sh
11 local _keychain_env_sh_gpg
13 # load agents to start.
14 zstyle -s :omz:plugins:keychain agents agents
16 # load identities to manage.
17 zstyle -a :omz:plugins:keychain identities identities
19 # load additional options
20 zstyle -a :omz:plugins:keychain options options
23 keychain ${^options:-} --agents ${agents:-gpg} ${^identities} --host $SHORT_HOST
25 # Get the filenames to store/lookup the environment from
26 _keychain_env_sh="$HOME/.keychain/$SHORT_HOST-sh"
27 _keychain_env_sh_gpg="$HOME/.keychain/$SHORT_HOST-sh-gpg"
29 # Source environment settings.
30 [ -f "$_keychain_env_sh" ] && . "$_keychain_env_sh"
31 [ -f "$_keychain_env_sh_gpg" ] && . "$_keychain_env_sh_gpg"