summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorToby Vincent <tobyv13@gmail.com>2021-03-28 16:34:07 -0500
committerToby Vincent <tobyv13@gmail.com>2021-03-28 16:34:07 -0500
commitac4872e7ef9d31e7c4b99dab9331c06084556b80 (patch)
tree2a746c625553b40c3be28b7e2d43b67301cec290
parentb38ddea186ff798ae40b8e97448a5390a6ce7efa (diff)
feat: added ssh.zsh script
-rw-r--r--zprofile23
-rw-r--r--zsh/ssh.zsh22
-rwxr-xr-xzshrc2
3 files changed, 25 insertions, 22 deletions
diff --git a/zprofile b/zprofile
index f0ceafa..e77496f 100644
--- a/zprofile
+++ b/zprofile
@@ -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
diff --git a/zshrc b/zshrc
index c137ef7..c575d5b 100755
--- a/zshrc
+++ b/zshrc
@@ -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