Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with tmux-resurrect #16

Open
dmguezjaviersnet opened this issue Oct 10, 2022 · 2 comments
Open

Problem with tmux-resurrect #16

dmguezjaviersnet opened this issue Oct 10, 2022 · 2 comments

Comments

@dmguezjaviersnet
Copy link

dmguezjaviersnet commented Oct 10, 2022

tmux-resurrect is an amazing tmux plugin that allows your tmux sessions to be persistent after reboot. It has an amazing feature that allows you to also load your vim/nvim sessions afterwards as especified here restore-vim-sessions. Now the issue is when I restore my tmux session it attempts to automatically load all nvim sessions but for some reasons it can't. The feature requires that the corresponding session.vim are present in order to be able to load them. Hope anyone can reproduce the issue, thanks in advance. Sorry for opening the other issue 🙏. Amazing nvim plugin btw.

@jedrzejboczar
Copy link
Owner

Hi, looking into restore-vim-session code it seems to rely on the -S parameter when starting vim, and on the fact that vim-obsession stores session files in current directory as Session.vim.

So there are 2 problems with implementing this using possession.nvim:

  1. Possession uses JSON files and stores the usual content of session.vim in the vimscript field in the JSON
  2. Possession stores session files in a common directory (defaults to ~/.local/share/nvim/possession), not in the current dir

So this is harder to implement than it is when using the vim-obsession model.

To implement auto-restoring of sessions you would need some way of knowing which session should be restored in which directory. Vim-obsession just checks if Session.vim is in current directory. In possession it is possible to list all the sessions using possession.query.as_list, you would then need to find the ones with session.cwd matching the current directory. Then you could load the matching one (and somehow handle the case when more than 1 session matches).

Then you would need to expose this in some convenient command so that it's possible to just call it from command line. Currently you can nvim -c "PossessionLoad MySession", but ideally we would have nvim -c "PossessionLoadCwd" or something similar (it would auto-determine which session to load, if any).

So integration with tmux-resurrect boils down to auto-loading, which has also been discussed in #3 and #12. I don't know what would be best approach to this, so I don't think I would be implementing this anytime soon. But if someone would like to implement auto-loading I'd be happy to help.

@dmguezjaviersnet
Copy link
Author

Thanks for the reply @jedrzejboczar, I assumed it would be tedious to do given the way this plugin works. Glad to hear i'm not the only one looking for automatic session load/restore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants