Skip to content

Sessions being merged when selecting a different session #164

Answered by olimorris
rbhanot4739 asked this question in Q&A
Discussion options

You must be logged in to vote

Actually, there's nothing in that behaviour which is unexpected and I touch on your use case in the README, see the Events/Callbacks section:

A commonly requested example is to use the Telescope extension to load a session, saving the current session before clearing all of the open buffers:

vim.api.nvim_create_autocmd("User", {
 pattern = "PersistedTelescopeLoadPre",
 callback = function(session)
   -- Save the currently loaded session using the global variable
   require("persisted").save({ session = vim.g.persisted_loaded_session })

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

The loading of a session simply uses vim's native source function (:…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by olimorris
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants