alangrainger / obsidian-lazy-plugins

Load plugins with a delay on Obsidian startup, so that you can get your app startup down into the sub-second loading time.
MIT License
229 stars 1 forks source link

[Feature Request] Provide more triggers on which plugins may be loaded #11

Open clorl opened 1 month ago

clorl commented 1 month ago

Feature Description

Currently, there are a few triggers to choose when to load a plugin: Instant, Short Delay, Long Delay, Disabled. All of them are time-based.

You could implement more trigger types base on Obsidian provided events after which plugins may lazy-load, similarly to neovim's lazy package manager.

For example, a user could set a plugin to load when a specific file is opened, when any file is opened, when entering edit mode, etc.

Here are some examples of triggers that could be implemented :

codey-badger commented 1 month ago

If there's a roadmap I would like to see this on it.

kylek29 commented 3 days ago

I could see this as a very useful expansion. I do this manually to control the memory usage on Android -- very important on A15/A16 because of its aggressive memory manager (it evicts rather quickly).

To give a use-case, I have a custom JS script that looks for special property flags when a note loads, these kick off a loading group which enables plugins within that group.

For an example, I may have a "My Movie Reviews Table.md" note that has a property of `required_plugins: ['DataView', 'Meta-Bind', '...'] .. the customJS script reads that property on note load and then kicks off the required plugins if necessary.

So one expansion is to allow each plugin to be added to custom groups (a plugin could belong to numerous different groups) the user creates and then have user-commands for enabling/disabling those groups.