stevearc / resession.nvim

A replacement for mksession with a better API
MIT License
220 stars 15 forks source link

feat: emit `User` autocmd events on completing certain actions #33

Closed Subjective closed 1 year ago

Subjective commented 1 year ago

I have a specific use case for having User events emitted that can't be solved via hooks. I think it would be great if this option was provided, similar how native sessions emit SessionLoadPost

Subjective commented 1 year ago

This is somewhat unrelated, but is there any way to determine a tab's handle given its number? Ideally, there would be some way to clear a tab-scoped session when its corresponding tab is closed, maybe something along the lines of:

vim.api.nvim_create_autocmd("TabClosed", {
  group = vim.api.nvim_create_augroup("ResessionClearTabSession", { clear = true }),
  callback = function(args)
    local tab = tab_num_to_handle(args.file)
    tab_sessions[tab] = nil
    -- M.detach(_, _, tab)
  end,
})