]> git.rmz.io Git - dotfiles.git/commitdiff
tmux: update env variables when attaching a tmux session
authorSamir Benmendil <me@rmz.io>
Sun, 17 Jan 2021 23:24:18 +0000 (23:24 +0000)
committerSamir Benmendil <me@rmz.io>
Sun, 17 Jan 2021 23:24:18 +0000 (23:24 +0000)
The main reason is to update SSH_AUTH_SOCK to support the new forwarded
ssh agent.

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

diff --git a/zsh/lib/tmux.zsh b/zsh/lib/tmux.zsh
new file mode 100644 (file)
index 0000000..296f428
--- /dev/null
@@ -0,0 +1,7 @@
+if [[ -n "$TMUX" ]]; then
+    function update-env {
+        # update environment from tmux
+        eval $(tmux show-environment -s)
+    }
+    preexec_functions+=(update-env)
+fi