Skip to main content
  1. Blog/

How I fixed Obsidian's Slow Startup

·295 words·2 mins

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-StartupScriptor something something shorter like StartupScript

  • 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 note

  • Paste 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 and GenerateListOfInstalledPlugins to your templates folder (create a Templates folder if you don’t have one).

  • Set the template folder location in Templater settings

    slow-startup_image_1.png

  • Add FastStart-StartupScript as a startup template.

    slow-startup_image_2.png

Creating Plugin Groups
#

  • Create a pluginsList note
  • Run Templater: Open Insert Template modal command from the command palette (Ctrl+P)
  • Insert GenerateListOfInstalledPlugins template into pluginsList
    slow-startup_image_3.gif
  • Paste plugin ids into their respective groups
Have each plugin on a new line.

slow-startup_image_4.png

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.