top | item 40929433

(no title)

llagerlof | 1 year ago

Just a suggestion. One of the best features of pure text editors (and incredible, not all of them implement it) is autosave keeping the "unsaved" state of the file.

For example, if you make some changes in a file (new or not), don't save the changes, close and open the editor, the state of the opened files are kept like I never had closed the editor. The unsaved files are still unsaved. New edited files are still there, unsaved, ready to user manually save them.

Notepad++ works that way, and it is an amazing feature.

discuss

order

mintplant|1 year ago

Similarly, I have unlimited persistent per-file undo turned on in Neovim. I can open any file I've edited previously and walk through the full history of how it got there. With Undotree [0], I can even navigate branching paths in development. I don't know how people live without this.

[0] https://github.com/mbbill/undotree

rustyminnow|1 year ago

What are your undo settings? I set undofile and undodir, but not sure if it's unlimited.

One issue I have is if nvim is closed and the file is touched by some outside process (say git pull) it clobbers the history. Do you know if there's a fix to that?

sa-code|1 year ago

Sublime works this way and I do appreciate it

mhuffman|1 year ago

Just an fyi, I have shot myself in the foot with Sublime's version of this. I became dependent on using unnamed/unsaved documents for quick notes, then at some interval I would clean up. And because Sublime would remember, I could rest safe that they would be there even if closed and reopened until I cleaned them up myself. Well, I also got so hooked on Sublime, I set it as my default system text editor. Then, (more than once), I would click a downloaded text file or something that would open in another window. Then after browsing or something I would be back in my original Sublime window. Close it for the day and as I was closing other windows realize there is another Sublime window still open with that document that I read early ... and all my other temp notes were gone! If you are good at grepping you can still find the files cached on your system with a little work, but something to watch out for. Or just get used to saving files somewhere.

shitlord|1 year ago

I have a tab in Sublime Text for my todo list, which I created several years ago and never bothered to save. It's a great feature for indecisive procrastinators.

zelphirkalt|1 year ago

I think Emacs does this too, if you configure it, or even by default, using its backup files, that go by #some_name# or similar.

emporas|1 year ago

Emacs definitely does this. I have saved many files from power outages. M-x recover-file, but the user has to recover the file right away when he opens it again or else a new auto-save will overwrite the old one. I think that's the case.

jhoechtl|1 year ago

While I love Emacs it's not like this. Scratch buffer? C-c C-x and all is gone without any warning.

rbanffy|1 year ago

I wouldn’t mind auto saving and allowing me to undo changes from the previous session.

TiredOfLife|1 year ago

Jetbrains ides even have something like a shadow git.

ziml77|1 year ago

Even Windows Notepad supports hot-exit now.

8372049|1 year ago

And dark mode! And tabs! I love notepad.exe of the future. What a time to be alive

stavros|1 year ago

Is this if you close the entire editor? If you just close the file, do the changes remain next time you open it?

369548684892826|1 year ago

Just if you close the entire editor. Editors with this feature, if you close the file it will ask if you want to save changes, click no and the changes are lost.

andrepd|1 year ago

So does sublime. Indeed I rely on this behaviour almost unconsciously.