tmux-plugins / tmux-continuum

Continuous saving of tmux environment. Automatic restore when tmux is started. Automatic tmux start when computer is turned on.
MIT License
3.31k stars 149 forks source link

tmux-continuum doesn't work when .tmux.conf is a symbolic link in WSL 2 #138

Open kevin-ctera opened 7 months ago

kevin-ctera commented 7 months ago

I recently started using WSL 2 instead of WSL 1. With the change, I found that tmux-continuum was no longer working.

I found it is related to having a symbolic link for .tmux.conf.

$ ls -al .tmux.conf

lrwxrwxrwx 1 kevin kevin 40 Oct 26 11:12 .tmux.conf -> /gdrive/gapps/genv/linux/home/.tmux.conf

I do this because I set up Linux in multiple environments and have to bring up new ones from time to time and can run a script I've created to create links to config files and keep changes/additions in sync between environments.

As a workaround, I've had to change .tmux.conf to a regular file and tell it to source a different file that I update:

$ cat .tmux.conf

# workaround symbolic link issue in WSL 2 for tmux-continuum
source-file /mnt/c/Users/kevin/gdrive/gapps/genv/linux/home/.tmux.conf.main

Plugin content of .tmux.conf.main

$ tail -15 /mnt/c/Users/kevin/gdrive/gapps/genv/linux/home/.tmux.conf.main

# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @continuum-restore 'on'
set -g @resurrect-capture-pane-contents 'on'
set -g @resurrect-strategy-vim 'session' # for vim
set -g @continuum-save-interval '5'
set -g @override_copy_command 'clip.exe'

# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'

I did not find that any other plug-ins are having issues with the symbolic link in WSL 2 outside of tmux-continuum (EG: prefix + Ctrl-s - save, prefix + Ctrl-r - restore work as expected).

The symbolic link doesn't matter in WSL 1 and all plugins work as expected

Is it possible to determine what causes this behavior and fix it?

GitBluub commented 7 months ago

Can confirm, I have a similar setup (symlink, wsl2) and same bug for me, the automatic saving works but not restoring when starting tmux

GitBluub commented 7 months ago

It is fixed with https://github.com/tmux-plugins/tmux-resurrect/pull/289 for me, so not a problem in tmux-continuum i guess

kevin-ctera commented 7 months ago

@GitBluub thanks for pointing that out. I followed the proposed change in https://github.com/tmux-plugins/tmux-resurrect/pull/289 but it's still not working if I have a link. Are the changes below all you did?

image