folke / persistence.nvim

💾 Simple session management for Neovim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

feature: Optionally save Session.vim file in current directory as well

shaun-mathew opened this issue · comments

Did you check the docs?

  • I have read all the persistence.nvim docs

Is your feature request related to a problem? Please describe.

I am currently using tmux-resurrect (https://github.com/tmux-plugins/tmux-resurrect/tree/master) to restore tmux sessions. This plugin has an optional neovim integration where it looks for a Session.vim file in the current folder and loads the neovim/vim session (See https://github.com/tmux-plugins/tmux-resurrect/blob/master/docs/restoring_vim_and_neovim_sessions.md). Since Persistence.nvim stores the sessions in a shared directory and not the current folder, tmux-resurrect cannot load neovim with the saved session.

Describe the solution you'd like

Have an additional option to save a Session.vim file in the working directory as well or a symlink. The option could look like this.

{
  dir = vim.fn.expand(vim.fn.stdpath("state") .. "/sessions/"), -- directory where session files are saved
  options = { "buffers", "curdir", "tabpages", "winsize" }, -- sessionoptions used for saving
  pre_save = nil, -- a function to call before saving the session
  save_empty = false, -- don't save if there are no open file buffers
  save_session_vim = true, -- create a Session.vim file in the project directory as well
}

Describe alternatives you've considered

tpope has the vim-obsession plugin, but I'm currently using lazyvim and I'd rather use the integrated solution.

Additional context

No response