]> git.rmz.io Git - dotfiles.git/commitdiff
zsh: update SSH_AUTH_SOCK whithin zellij master
authorSamir Benmendil <me@rmz.io>
Fri, 10 Oct 2025 06:40:53 +0000 (07:40 +0100)
committerSamir Benmendil <me@rmz.io>
Fri, 10 Oct 2025 06:40:53 +0000 (07:40 +0100)
This allows ssh agent forwarding to keep working after each ssh
reconnect.

zsh/lib/zellij.zsh [new file with mode: 0644]

diff --git a/zsh/lib/zellij.zsh b/zsh/lib/zellij.zsh
new file mode 100644 (file)
index 0000000..a30b799
--- /dev/null
@@ -0,0 +1,7 @@
+if [[ -n "$ZELLIJ" ]]; then
+    function update-env {
+        # set SSH_AUTH_SOCK to latest socket
+        export SSH_AUTH_SOCK=$(realpath /tmp/ssh-XXXX*/*(om[1]))
+    }
+    preexec_functions+=(update-env)
+fi