antoniotejada / obsidian-edit-history

Obsidian Edit History Plugin, automatically save all the edit history of a note, browse and restore previous versions
GNU Affero General Public License v3.0
55 stars 0 forks source link

FR: Persistent Undos #3

Open chrisgrieser opened 1 year ago

chrisgrieser commented 1 year ago

One pretty awesome feature that I know from a different app (vim) is the concept of so-called persistent undos, which could be an interesting feature for this plugin.

The idea is you make your undo history persist across sessions by storing them in edit history files, not too dissimilar from this plugin. Based on this plugin's settings, the granularity of undos would get lost, but it's still a big plus compared to not having anything.

Basically, what this plugin would have to do is somehow "hook into" Obsidian's ctrl-z (or cmd-z) when Obsidian reaches the end of its own undo history.

antoniotejada commented 1 year ago

Haha great minds think alike.

There's a todo about that in the code:

// XXX Feed the editor undo stack with the contents of the history file? (could
//     be done without private apis by inserting the text in edit history order at file
//     load, will probably need a flag to prevent from storing double history)

https://github.com/antoniotejada/obsidian-edit-history/blob/6d55e99c4ff098d8a9ec2e5dbe5d56420278a7f4/main.ts#L71C1-L73C79

Leaving open to consider implementing.

Archie-2021 commented 1 year ago

Yeah , such a feature is very needed. I think using something like git for obsidian is a overkill and unnecessarily complicated. Also I would like to see some features like undo-tree plugin for vim in obsidian.

Thanks