Closed jordwalke closed 6 years ago
wintabs stores a list of "local" buffers to each window, so it's unlikely I can re-use any code from undoquit. That being said, undo closing buffer/window/tab sounds like a great feature to have. I'll look into it when I have time.
Did you give any thought to this? Have you found the need for such a feature in your day to day use? Once you get use to undoquit, it's hard to loose the feature.
I was thinking that 90% of the value could be gotten from only supporting the use case of one undo level - the ability to revert the most recently closed wintab, regardless of which window it was closed from.
I've thought about this and would implement it as undo closing buffers without considering window and vimtab configurations, just like what you suggested. I haven't got the time yet, but will do it in the next round of clean ups (a few bugs and documentation).
This is implemented in the last commit, please check it out!
Very cool can’t wait to check it out
I think the only thing remaining here is to track which "approximate window" the tab was closed from. Was it the last open tab in a window that resulted in the window closing? If so, then a new window should probably be opened (it's hard to restore the exact window position of course but some simple setting could configure how new windows are opened if not instructed specifically (vert/horiz)).
If it was closed from a window that is still open, then it should probably reappear in that window it was removed from.
Either way, this is still a nice feature as it is.
Opening in original window is doable, it requires giving windows unique ids, which isn't too hard. It however is a bit too jumpy to my taste: e.g. I really hate how Chrome undoes closed tabs inside different windows. I'll think about what's the best next step here after some other features.
I think one compromise is to only "Undo Close" within the same tab. WintabsUndo
would then undo the closing of the most recent buffer/window in the currently focused tab. That's not as jarring as jumping to a completely different tab to undo the close. Jumping to another tab would feel like jumping to another Chrome window to undo the close.
If you can accept that, then you might want to keep track of the most recently closed buffer on a per-tab basis.
I decided not doing window scoped undo for now as it involves some unnecessarily challenging edge cases. I added some commands to move buffer across windows. That combined with current undo should be able to satisfy most use cases. I'm closing this but please open another issue if these two are not enough for your workflow.
This plugin is tremendously helpful. It would be nice if it could work well together or have the functionality baked into wintabs. Currently it doesn't work with wintabs. https://github.com/AndrewRadev/undoquit.vim