From a1ee14f849f1f97ad2b68e598110218524a201aa Mon Sep 17 00:00:00 2001 From: Samir Benmendil Date: Fri, 11 Mar 2022 08:43:07 +0000 Subject: [PATCH] vim: UpdateTmuxEnv function to import SSH_AUTH_SOCK When a new ssh session to an existing tmux session is opened the ssh-agent forwarding will use a new SSH_AUTH_SOCK path. This env variable is updated within the tmux session, but running applications will need to update it themselves. Really this should be done automatically. --- vim/plugin/update_tmux_env.vim | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 vim/plugin/update_tmux_env.vim diff --git a/vim/plugin/update_tmux_env.vim b/vim/plugin/update_tmux_env.vim new file mode 100644 index 0000000..01df515 --- /dev/null +++ b/vim/plugin/update_tmux_env.vim @@ -0,0 +1,7 @@ +function! UpdateTmuxEnv() + let env = trim(system("tmux showenv SSH_AUTH_SOCK")) + let es = split(env, "=") + call setenv(es[0], es[1]) +endfunction + +command! -nargs=0 UpdateTmuxEnv call UpdateTmuxEnv() -- 2.48.1