In VSCode or some other IDEs, when you’re in a workspace and you close a tab, the edit history is preserved, so when you open the same tab back up you can still do, say, undo last edit. Is this option possible with ST4?
How to preserve edit history after tab closed
Sounds like there’s some 3rd party plugins that could do this but native support has been added according to this?
Undo history is stored in sessions/workspaces. We don’t keep undo history or unsaved changes for closed files.
But it’s not just unsaved files. If I close the tab, seems like I’m not able to retrieve the change history regardless of whether it was saved or not?
My apologies, that was an incorrect statement. How can I keep the unsaved change history as well?
You’d need to save the project/workspace. These things are under the Project menu. See also https://www.sublimetext.com/docs/projects.html
I must be doing something wrong cuz I saved it as both a workspace and a project but a file’s change history still disappears when I close then reopen it…?
As I said undo history or unsaved changes aren’t kept for closed files. They are kept for files opened in a project/workspace. Closing a workspace will save unsaved changes and undo history in the workspace file.
This is what I did:
- open my project workspace (saved as both workspace and project)
- click open a main.rs file
- add some random comment somewhere
- save it
- close the main.rs file/tab
- click open the main.rs file again
At this point the undo button is grey and I can’t undo the random comment I added.
If you close the workspace by closing the window or using Project > Close Project the undo history will be kept along with unsaved changes. Undo history and unsaved changes aren’t kept for closed files.
welp this is what I meant in the original post. Sry it was confusing. Is there a way to keep the change history for closed files?
There isn’t, using workspaces is the alternative. Plugins also can’t provide such a feature.
Could this be a feature request? Looks like I’m not the only one hoping for this. Other editors have it?
You can submit feature requests on github. In Sublime Text use the Help > Report a Bug menu item.