olimorris / persisted.nvim

💾 Simple session management for Neovim with git branching, autoloading and Telescope support

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature Request: Ignore certain filetypes

shaun-mathew opened this issue · comments

commented

Sometimes I close Neovim with NvimTree or Trouble open and upon loading the Session, an empty NvimTree buffer and a pane is created to the side. It would be a nice feature if we could ignore certain filetypes when saving sessions.

Screenshot
After loading session:
nvimtree

commented

Hey @shaun-mathew. Have you looked at implementing your own custom callbacks? I use them to stop minimap being recorded into my session.

commented

Yep, I added something like this to my config that gets the job done:

config = function()
  require("persisted").setup {
    autosave = true,
    before_save = function()
      vim.cmd "NvimTreeClose"
    end,
  }
end

I was just wondering if what I suggested would be possible as a sort of convenience method where the user could specify a list of filetypes and before saving the session, the plugin could go around closing all windows with that filetype. Although, I assume it would get a bit messy.

commented

The reason for adding the callbacks was mainly because I was seeing a lot of singular edge cases crop up that if addressed directly in the plugin, would move it further away from being a "simple session management" plugin.

I ultimately see the callbacks as the plugin's admission that it will never be able to cater for everyone's use cases and therefore it should give the user the ability to dictate how it functions for their given workflow.

Hi ouhm 😅 I'm in trouble with this issue. Is there any config that ignores the window and the buffer of nvim-tree? Thank you!