Undo deletion of note

Use case or problem

As someone who likes to keep his notes database clean and organized, I often delete empty or no longer useful notes (Ctrl+Shift+Del). Often, when I do this too fast, I accidentally delete the wrong note, and immediately hit Ctrl+Z in attempt to recover the file from my Recycle Bin, to no avail.

Proposed solution

Since Ctrl+Z is used for Edit Mode undos, I suggest Ctrl+Shift+Z to undo all file movement / deletion related actions (similar to Mac/Windows file navigation behavior). For example, this feature would quickly remediate the following: dragging and dropping files into wrong folder, deleting the wrong note / folder, perhaps even creating a new note by accident?

Current workaround (optional)

I currently have to go to my recyble bin, look for and recover the said file.

Thanks!

19 Likes

You may want to look into using software revision control like “git”. I believe there is a plug-in called obsidian-git that helps automate this process.

1 Like

I have tried several community plugins (for other purposes) and from my experience those can sometimes be a little buggy.

Just curious if there is sufficient community support to warrant this feature as “default-behavior-worthy” to be included in future releases. Or at least added as a Core Plugin. Thanks for the response.

2 Likes

Use case or problem

Set up: I have Obsidian’s “Deleted files” configured to “Move to system trash”, and env is Mac OSX Catalina with Obsidian 0.9.15.

Use-case: If 1) I accidentally delete a file from within Obsidian (either by right-clicking -> Delete or by keyboard shortcut, and then 2) I press cmd+z or select “Edit -> Undo”, nothing happens.

If I go to the system’s trash and I right click on the deleted note, the usual “Put back” menu option isn’t there and I can’t double-click to open the file and copy-paste the contents because you can’t open files while they’re in OSX’s system trash.

Proposed solution

  • Make Undo and cmd+z actually undo delete file operations if the file still exists.
  • Make files sent to the system’s trash have a “Put back” menu option so that it’s easier to recover them if for some reason you can’t recover them from within Obsidian.

Current workaround (optional)

I have to open the system’s trash and manually move the file to my vault.

8 Likes

@juan I’m glad we are on the same page on this. I now have the deleted files moved to Obsidian trash (.trash folder) option enabled in my settings, just as a safeguard in case I delete something valuable to my (frequently emptied) recycle bin.

Use case or problem
A new problem now arises, as for some reason, “.trash” folder does not show up in the file explorer panel on the left, nor does it show up in Ctrl+O searches.

Proposed solution
Display “.trash” folder in file navigation panel. And make Cmd+Z / Ctrl+Z undo file deletion, similar to my initial post.

4 Likes

I may be a little obtuse (no comments necessary), but why is there an option for sending deleted files to a “.Trash” if there is no way to access the folder by the User? Or maybe the question should be…Why can I not Recover a deleted file when selecting the UI option “Move to Obsidian trash”?

5 Likes

I am with you on this as well. The UI is not great.

But the current stop-gap solution at least keeps my accidentally deleted notes “safe”, where I can retrieve it manually via file browser if I ever needed to.

I think all we need is a secondary option to have deleted files moved to a non-hidden folder- ‘Trash’, ‘Trash_Obsidian’, etc.

(or folder name customizable by user.)

3 Likes

I find a third-party solution for that:
you can use google drive to sync your Vault Folder , then when you Try to delete any files in your vault it’s automatically go to google drive trash and you can restore theme easily .

1 Like

Thanks Issam. I prefer to not add an external dependency like that because it introduces a host of sync issues. For now I’m relying on both Obsidian Sync and a .git repo within the vault. It’s not a great experience and I’m still hit by this issue (yesterday for example), but I can manage until we have undo delete file.

2 Likes

This seems like a pretty obvious and basic feature and I wonder why it isn’t there yet?
A simple app like Notes (Mac) allows us to recover a deleted note.
It’s the kind of workflow that any user would expect from the Undo.

Also, I just noticed that if we use Undo after renaming a note, that won’t undo the renaming of the note (which it should), but it just undoes whatever editing we did on the note itself, which is weird as well.

Please add / fix these things. It shouldn’t be expected that user re-learns something that is common in other apps, as well as having to find workarounds for something that should be native.

1 Like

This link has the technical answer for why “moving a file to ~/.Trash doesn’t give macOS the right metadata to ‘Put Back’ the file from Finder”

It looks like Obsidian, (or possibly a plugin) would need to also edit ~/.Trash/.DS_Store – but I’m unsure if this is supported for third-party apps…