vimtricks.wiki Concise Vim tricks, one at a time.

How do I diagnose slow Neovim startup and identify which plugins are taking the longest to load?

Answer

:Lazy profile

Explanation

When Neovim starts slowly, finding the culprit plugin is tedious without tooling. lazy.nvim ships a built-in profiler that records the load time of every plugin and presents them in an interactive, sortable UI. Running :Lazy profile immediately shows you exactly where startup time is being spent, so you can tune your lazy-loading configuration with real data instead of guessing.

How it works

  • :Lazy opens the lazy.nvim plugin manager UI
  • :Lazy profile opens the profile view directly, showing all plugins with their load times in milliseconds
  • Results are sorted by load time by default — the slowest plugins appear first
  • You can see whether each plugin was loaded eagerly (on startup) or lazily (on demand)
  • Press <CR> on a plugin entry to view its configuration and loading triggers

To enable profiling across sessions, set profiling = { loader = true, require = true } in your lazy.nvim config.

Example

After a fresh Neovim open, run :Lazy profile. The output might show:

 Plugin                     Time
 nvim-treesitter            45ms  (eager)
 nvim-lspconfig             12ms  (event: BufReadPost)
 telescope.nvim              8ms  (cmd: Telescope)

This tells you nvim-treesitter is loading on every startup and may be worth converting to a lazy event trigger.

Tips

  • Add lazy = true to plugins that don't need to load at startup; trigger them on event = 'BufReadPost' or cmd = ... instead
  • :Lazy health runs a health check across all installed plugins
  • :Lazy sync updates all plugins to their latest versions
  • Use --profile in your Neovim startup wrapper script to capture profiling data externally with nvim --startuptime /tmp/startup.log

Next

How do I incrementally expand or shrink a selection based on syntax tree nodes using nvim-treesitter?