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

[Bug]: howto pin a buffer through sessions switching?

tmpm697 opened this issue · comments

Your Persisted.nvim config

  {
    name = "PersistedHooks",
    {
      "User",
      function(session)
        require("persisted").save()

        -- Delete all of the open buffers
        vim.api.nvim_input("<ESC>:%bd!<CR>")

        -- Don't start saving the session yet
        require("persisted").stop()
      end,
      opts = { pattern = "PersistedTelescopeLoadPre" },
    },
  },

Error messages

No response

Describe the bug

I want to pin / sticky a buffer through sessions save/switching, more verbose below:

Reproduce the bug

  1. at sessionA
  2. :term
  3. <C-\><C-n> to bring terminal buffer to normal mode (you can now switch to other buffers)
  4. open some buffers under sessionA
  5. :SessionSave
  6. switch to sessionB --> with above minimal config, terminal buffer from sessionA will be deleted

How to not save terminal buffer from sessionA at step 5? other buffers at step 4 should still be saved to sessionA.

When switch to sessionB at step 6, terminal buffer from sessionA should be avail/merged to sessionB buffers list

Final checks

  • I have made sure this issue exists in the latest version of the plugin
  • I have tested with the minimal.lua config file above and still get the issue
  • I have used SessionSave to save the session before restarting Neovim and using SessionLoad
  • I have made sure this is not a duplicate issue
commented

I'm not sure this is a bug and is more of a how to.

Suggest opening a discussion so others can feed in