API / callback for 'file-rename' event?

I looked through the API but didn’t see any way to register a callback if a file is renamed from within the editor or File explorer. Maybe I missed it.

@tgrosinger’s excellent Recent Files plugin is a great example of where this would be useful to have. There’s an open issue for it already.

Is this something on the roadmap? Thank you

1 Like

I don’t know how officially supported this is, but app.vault.on("rename", function(file, oldname) {}) will notify you of renames done from Obsidian’s file manager or pane title fields. It does not notify about renames initiated from outside of Obsidian.


I’ll take a look, thanks for the suggestion.

1 Like

@pjeby that suggestion was perfect. Thank you!

I’ve updated the plugin to add support for file renaming.