persistence.nvim icon indicating copy to clipboard operation
persistence.nvim copied to clipboard

multiple session per directory.

Open Chaitanyabsprip opened this issue 3 years ago • 10 comments
trafficstars

I would like to see this plugin's functionality extended to have 1) a chooser of sessions and 2) ability to have multiple session for the current project(current directory). 2) can help in having separate sessions per branch as well.

Chaitanyabsprip avatar Dec 30 '21 18:12 Chaitanyabsprip

+1 for git branch based sessions.

osenvosem avatar Jan 15 '23 18:01 osenvosem

Stumbled via LazyVim over Persistence and it is working great! :) But I also would wish for branched based sessions.

nikbrunner avatar Jan 29 '23 15:01 nikbrunner

+1 for session chooser and multiple sessions for same project directory :)

benjaminls avatar Oct 19 '23 04:10 benjaminls

Came here to add my +1

Angelelz avatar Oct 31 '23 21:10 Angelelz

I don't think multi-session management fits the purpose of this plugin, as it is a minimal wrapper for Vim's built-in session management routines. If we wand a feature-rich session manager, we should go with auto-session or persisted.

b0ae989c avatar Nov 30 '23 00:11 b0ae989c

I think that there is a better/cleaner way how to achieve sessions per branch, and that is through git worktrees. Git worktrees enable you to have several worktrees (several branches) in one git repo at the same time and switch between them.

  1. Use plugin like https://github.com/ThePrimeagen/git-worktree.nvim
  2. Hook that plugin such that when you switch git worktree (branch), it will send signal to Persistence.nvim (or to a different session management plugin) to switch sessions

With this setup you should be able to switch git worktrees (git branches) and Neovim sessions will automatically switch also. I have not yet tried this, it's on my TODO list :)

Dom324 avatar May 01 '24 22:05 Dom324

The problem with that approach is that you're(the maintainer of the plugin) asking the users to change their workflow, spend time learning and getting used to it in order to make use of you're plugin. I believe some alternative should be considered.

Chaitanyabsprip avatar May 02 '24 19:05 Chaitanyabsprip

@Chaitanyabsprip if you were answering my comment, I'm sorry but I'm not the maintainer of this plugin :) I just faced the same issue as you, but then I figured out that solving it through git worktrees is much cleaner.

If you really want to save sessions per branch, take a look at https://github.com/natecraddock/sessions.nvim . It's quite flexible and it probably allows to do what you want, although with a bit of code.

Dom324 avatar May 09 '24 22:05 Dom324

I did not mean that you are the maintainer. I was actually talking about the maintainer. For the session management per project per git part, I am not using a session manager anymore. I have also switched to git worktrees and I use harpoon to get to specific files.

Chaitanyabsprip avatar May 10 '24 08:05 Chaitanyabsprip