Skip to content

[Feature Request] Session Restoration Strategies #217

@igorlfs

Description

@igorlfs

Hello,

Great work with the plugin! Thanks for keeping it alive!

Currently, when restoring a (vim) session that contains diffview buffers, they are restored (as buffers do), but they are empty, and the usual diffview commands are unable to interact with them (e.g., if I were doing a :DiffviewOpen before saving the session, I can't use :DiffviewClose after restoring). This sucks, so I try to avoid saving sessions with diffview buffers.

I have some ideas of what the ideal workflow would be. The first one is simpler: using a SessionLoadPost autocmd to clean up the buffers. I happen to be a plugin author, and I'm using exactly this strategy with my plugin (the hook has to be eagerly loaded because a session might be restored before the plugin is "fully" loaded). IMO, wiping out the buffers is already a solid improvement. However, if you want to take this a step further, I have a second proposal.

Instead of deleting the buffers, their names could be parsed to try and recreate the "full" state (I have no idea if diffview's URIs are powerful enough to achieve this - and even if they are, it might be too complex, etc.). Would love to hear your thoughts.

I'm not sure how much of a session enthusiast you are, but oftentimes these "strategies" are delegated to session plugins, which is bad UX, IMO. For instance, last year I opened a PR to a session plugin to support yet another plugin, using an approach similar to the "cleanup on SessionLoadPost".

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions