From: Samir Benmendil Date: Fri, 11 Mar 2022 08:43:07 +0000 (+0000) Subject: vim: UpdateTmuxEnv function to import SSH_AUTH_SOCK X-Git-Url: https://git.rmz.io/dotfiles.git/commitdiff_plain/a1ee14f849f1f97ad2b68e598110218524a201aa 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. --- 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()