diff options
-rw-r--r-- | zprofile | 23 | ||||
-rw-r--r-- | zsh/ssh.zsh | 22 | ||||
-rwxr-xr-x | zshrc | 2 |
3 files changed, 25 insertions, 22 deletions
@@ -1,22 +1,3 @@ -SSH_ENV="$HOME/.ssh/agent-environment" +export ZSH_BASE="${HOME}/dotfiles" -function start_agent { - echo "Initialising new SSH agent..." - /usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}" - echo succeeded - chmod 600 "${SSH_ENV}" - . "${SSH_ENV}" > /dev/null - /usr/bin/ssh-add; -} - -# Source SSH settings, if applicable - -if [ -f "${SSH_ENV}" ]; then - . "${SSH_ENV}" > /dev/null - #ps ${SSH_AGENT_PID} doesn't work under cywgin - ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || { - start_agent; - } -else - start_agent; -fi
\ No newline at end of file +source $ZSH_BASE/zsh/ssh.zsh diff --git a/zsh/ssh.zsh b/zsh/ssh.zsh new file mode 100644 index 0000000..f0ceafa --- /dev/null +++ b/zsh/ssh.zsh @@ -0,0 +1,22 @@ +SSH_ENV="$HOME/.ssh/agent-environment" + +function start_agent { + echo "Initialising new SSH agent..." + /usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}" + echo succeeded + chmod 600 "${SSH_ENV}" + . "${SSH_ENV}" > /dev/null + /usr/bin/ssh-add; +} + +# Source SSH settings, if applicable + +if [ -f "${SSH_ENV}" ]; then + . "${SSH_ENV}" > /dev/null + #ps ${SSH_AGENT_PID} doesn't work under cywgin + ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || { + start_agent; + } +else + start_agent; +fi
\ No newline at end of file @@ -13,12 +13,12 @@ hash -d d=${HOME}/docker [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]] && source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" -grep -q docker /proc/1/cgroup || source $ZSH_BASE/zprofile source $ZSH_BASE/antigen/antigen.zsh source $ZSH_BASE/zsh/setopt.zsh source $ZSH_BASE/zsh/prompt.zsh source $ZSH_BASE/zsh/aliases.zsh source $ZSH_BASE/zsh/keybindings.zsh +[ ! -n "${SSH_AUTH_SOCK+1}" ] && source $ZSH_BASE/zsh/ssh.zsh [ -n "${WSL_DISTRO_NAME+1}" ] && source $ZSH_BASE/zsh/wsl.zsh antigen use oh-my-zsh |