Sublime text is not permanently saving file after close ( How to Disable undoing after Close )

454 Views Asked by At

I am using sublime text 4 ( recently released Version 4 ). BUT I am having a problem in permanently saving the file after close.

This problem was not in the sublime text 3.

What is the Problem :-

When i make changes in the file and save it and close sublime text then Reopen again and press Ctrl + Z then it it undoing the changes that i have made, BUT i want it NOT to undo the changes after close the file or close the sublime text.

In sublime text 3, Whenever i make changes then close the file then it never undo the changes ( which is good ) BUT this is the problem in the sublime text 4

I have also tried searching many times BUT i didn't find any solution.

Any help would be much Appreciated.

Thank You in Advance

2

There are 2 best solutions below

0
On

This is because in Sublime Text 4 (specifically from Build 4075 onwards), the undo history is stored in the session file (either the global session file if the current window is not associated with a project or the workspace file if it is). Sublime Text 3 did not have this ability.

Since the undo stack is stored in session, whenever you do some kind of edits on a file and exit the app, the undo continues to work for that file even after you open the app.

There is currently no way (as far as I know) to opt out of this behavior. You can create a feature request if you want on the official issue tracker.

1
On

I had this problem and found it frustrating to not be able to opt out of this behavior.

A quick fix I found was to close the file I'm about to work on (and only the file, not Sublime itself), and reopen it.

That clears the undo history, and now I have a safe point to ctrl-z back to in case I mess the code up beyond repair!