restore last session of my text editor I am looking for text editor which can reopen all my saved/unsaved tabs that was there in the last session before my mac got restarted or text editor got closed unexpectedly.

I always have my text editor open in any of my desktops in mac but if for some reason I need to reboot or text editor gets closed unexpectedly, then if I restart my mac or reopen text editor then it should bring back all windows that was opened in last session whether saved or unsaved.

I tried with Sublime but looks like it didn't work for me. Any thoughts?
TextEdit, which is part of every version of MacOS, does exactly that, if you check this box when shutting down or logging out.



The downside is trying to discipline yourself to put things away once in a while.  At this moment, I literally¹ have three dozen "Untitled" text windows in my Dock.

¹The pre-2000 meaning of "literally"