This is a quick guide on fixing Obsidian’s startup times. (credits: TfT Hacker)
Prerequisites#
- Obsidian (Duh!)
- Templater plugin
Setting up Templater#
Create a new note titled
FastStart-StartupScript
or something something shorter likeStartupScript
Paste the code below into the note:
<%* fastStart = async (filename, delayInSecond) => { if (tp.file.exists(filename)) { const f = tp.file.find_tfile(filename); let plugins = (await app.vault.read(f)).split(/\r?\n/); setTimeout(async () => { plugins.forEach(async (p) => await app.plugins.enablePlugin(p)) }, delayInSecond * 1000) } } await fastStart("FastStart-ShortDelay", 2) // plugin group 1 await fastStart("FastStart-LongDelay", 30) // plugin group 2 await fastStart("FastStart-LongerDelay", 35) // plugin group 3 %>
Create notes for different plugin groups: From the template above, I have 3 plugin groups:
FastStart-ShortDelay
FastStart-LongDelay
FastStart-LongerDelay
With 2, 30 and 35 seconds delay respectively.
You can play around with the delay, I found 2 seconds best for plugins I needed after Obsidian launches.
Each note would contain plugin ids. You can find the ids in the community plugins section or your vault’s .obsidian\plugins
directory.
An easier option is to have yet another script do just that:
Create a
GenerateListOfInstalledPlugins
notePaste the code below into the note.
<% Object.values(app.plugins.manifests).map(p=>p.id).sort((a,b)=>a.localeCompare(b)).join('\n') %>
Move
FastStart-StartupScript
andGenerateListOfInstalledPlugins
to your templates folder (create aTemplates
folder if you don’t have one).Set the template folder location in Templater settings
Add
FastStart-StartupScript
as a startup template.
Creating Plugin Groups#
- Create a
pluginsList
note - Run
Templater: Open Insert Template modal
command from the command palette (Ctrl+P
) - Insert
GenerateListOfInstalledPlugins
template intopluginsList
- Paste plugin ids into their respective groups
Final Steps#
- Disable all plugins except Templater (and other plugins you need on startup).
- Enable
Debug startup time
in the community plugins section to see how long it takes to load Obsidian. - Restart Obsidian.