addet keychain plugins
This commit is contained in:
parent
9ded2f08c1
commit
78cd1d6422
2 changed files with 52 additions and 0 deletions
50
.zsh/custom/agent.zsh
Normal file
50
.zsh/custom/agent.zsh
Normal file
|
@ -0,0 +1,50 @@
|
|||
export GPG_TTY=$TTY
|
||||
|
||||
# Fix for passphrase prompt on the correct tty
|
||||
# See https://www.gnupg.org/documentation/manuals/gnupg/Agent-Options.html#option-_002d_002denable_002dssh_002dsupport
|
||||
function _gpg-agent_update-tty_preexec {
|
||||
gpg-connect-agent updatestartuptty /bye &>/dev/null
|
||||
}
|
||||
autoload -U add-zsh-hook
|
||||
add-zsh-hook preexec _gpg-agent_update-tty_preexec
|
||||
|
||||
# If enable-ssh-support is set, fix ssh agent integration
|
||||
if [[ $(gpgconf --list-options gpg-agent 2>/dev/null | awk -F: '$1=="enable-ssh-support" {print $10}') = 1 ]]; then
|
||||
unset SSH_AGENT_PID
|
||||
if [[ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]]; then
|
||||
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
|
||||
fi
|
||||
fi
|
||||
|
||||
(( $+commands[keychain] )) || return
|
||||
|
||||
# Define SHORT_HOST if not defined (%m = host name up to first .)
|
||||
SHORT_HOST=${SHORT_HOST:-${(%):-%m}}
|
||||
|
||||
function {
|
||||
local agents
|
||||
local -a identities
|
||||
local -a options
|
||||
local _keychain_env_sh
|
||||
local _keychain_env_sh_gpg
|
||||
|
||||
# load agents to start.
|
||||
zstyle -s :omz:plugins:keychain agents agents
|
||||
|
||||
# load identities to manage.
|
||||
zstyle -a :omz:plugins:keychain identities identities
|
||||
|
||||
# load additional options
|
||||
zstyle -a :omz:plugins:keychain options options
|
||||
|
||||
# start keychain...
|
||||
keychain ${^options:-} --agents ${agents:-gpg} ${^identities} --host $SHORT_HOST
|
||||
|
||||
# Get the filenames to store/lookup the environment from
|
||||
_keychain_env_sh="$HOME/.keychain/$SHORT_HOST-sh"
|
||||
_keychain_env_sh_gpg="$HOME/.keychain/$SHORT_HOST-sh-gpg"
|
||||
|
||||
# Source environment settings.
|
||||
[ -f "$_keychain_env_sh" ] && . "$_keychain_env_sh"
|
||||
[ -f "$_keychain_env_sh_gpg" ] && . "$_keychain_env_sh_gpg"
|
||||
}
|
2
.zshrc
2
.zshrc
|
@ -153,6 +153,7 @@ _init (){
|
|||
local zTruecolor="$zconf/custom/256color.zsh"
|
||||
local zAutopairs="$zconf/autopairs/autopair.zsh"
|
||||
local zFzfCd="$zconf/custom/zsh-interactive-cd.plugin.zsh"
|
||||
local zAgentManagement="$zconf/custom/agent.zsh"
|
||||
|
||||
local _pluginlist=(
|
||||
"$zAutosg"
|
||||
|
@ -160,6 +161,7 @@ _init (){
|
|||
"$zTruecolor"
|
||||
"$zAutopairs"
|
||||
"$zFzfCd"
|
||||
"$zAgentManagement"
|
||||
)
|
||||
|
||||
DEBUG_PLUG=""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue