Skill

lazy-nvim-optimization

Install
1
Install the plugin
$
npx claudepluginhub kriscard/kriscard-claude-plugins --plugin neovim-advisor

Want just this skill?

Add to a custom plugin, then install with one command.

Description

Profiles Neovim startup performance and optimizes lazy.nvim plugin loading with targeted lazy-loading specs, priorities, and event triggers. Contains profiling workflow and bottleneck checklists. Make sure to use this skill whenever the user mentions slow neovim startup, neovim takes time to load, plugin profiling, lazy-loading, lazy.nvim config, startup time optimization, or neovim performance — even if the user doesn't say "lazy.nvim" explicitly.

Tool Access

This skill uses the workspace's default tool permissions.

Supporting Assets
View in Repository
examples/optimized-config.lua
references/lazy-loading-decision-tree.md
references/profiling-guide.md
Skill Content

Lazy.nvim Optimization

Diagnose and fix Neovim startup performance through profiling and targeted lazy-loading.

Profiling Workflow

When a user reports slow startup, follow this sequence — don't skip to solutions.

Step 1: Measure Baseline

nvim --startuptime startup.log && tail -1 startup.log

Compare against targets:

  • < 30ms: Excellent
  • 30-50ms: Good
  • 50-100ms: Acceptable
  • 100ms: Needs work

Step 2: Identify Slow Plugins

:Lazy profile

Look for plugins with load time > 10ms. These are your optimization targets. Sort by time, not alphabetically.

Also check the startup log for:

  • Files taking > 10ms to source
  • setup() functions taking > 5ms
  • Synchronous operations blocking startup

Step 3: Apply Lazy-Loading

For each slow plugin, choose the right trigger:

Plugin TypeTriggerExample
Has clear commandscmdcmd = "Telescope"
Accessed via keybindingskeyskeys = { "<leader>e" }
Language-specificftft = { "rust", "go" }
Needed after UI rendersevent = "VeryLazy"UI enhancements
Needed when editingevent = "BufReadPost"Git signs, diagnostics
Needed in insert modeevent = "InsertEnter"Completion, autopairs
Only used as dependencylazy = trueplenary.nvim

Step 4: Verify Improvement

nvim --startuptime startup-after.log && tail -1 startup-after.log

Compare total times. Then :Lazy profile to verify plugins load when expected.

What NOT to Lazy-Load

These need to load at startup — don't fight it:

  • Colorscheme — Set priority = 1000 so it loads first. Visible flash if deferred.
  • Treesitter — Needed for syntax highlighting immediately. Deferring causes flicker.
  • Statusline — Visible at startup. Deferring causes layout shift.
  • which-key — Only if it shows on startup. Otherwise can lazy-load.
  • LSP base setup — Though individual servers can lazy-load by filetype.

Common Bottlenecks

Synchronous system calls at startup:

-- Bad: blocks startup
vim.fn.system("git status")

-- Good: defer it
vim.defer_fn(function()
  vim.fn.system("git status")
end, 100)

Loading all LSP servers at once: Consider loading LSP servers per-filetype instead of all at startup. Each server you don't load saves 5-15ms.

Plugins without any trigger: A bare { "plugin/name" } spec loads at startup. Always add a trigger unless the plugin genuinely needs immediate availability.

Performance Checklist

Startup

  • Colorscheme has priority = 1000
  • File explorers load on cmd/keys
  • Git interfaces load on cmd/keys
  • Completion loads on InsertEnter
  • Language plugins load on filetype
  • UI enhancements load on VeryLazy

Runtime

  • Telescope uses fzf-native extension
  • Treesitter parsers installed only for used languages
  • LSP servers only for filetypes you use
  • No plugins duplicating built-in 0.10+ features

Config

  • No synchronous system calls at startup
  • setup() only runs when plugins load
  • Keymaps defined with plugin lazy-loading
  • Auto-commands use specific events, not "*"

Reference Files

For detailed information:

  • references/lazy-loading-decision-tree.md - Decision tree for choosing lazy-loading strategy
  • references/profiling-guide.md - Advanced profiling techniques
Stats
Stars2
Forks0
Last CommitFeb 25, 2026
Actions

Similar Skills

cache-components

Expert guidance for Next.js Cache Components and Partial Prerendering (PPR). **PROACTIVE ACTIVATION**: Use this skill automatically when working in Next.js projects that have `cacheComponents: true` in their next.config.ts/next.config.js. When this config is detected, proactively apply Cache Components patterns and best practices to all React Server Component implementations. **DETECTION**: At the start of a session in a Next.js project, check for `cacheComponents: true` in next.config. If enabled, this skill's patterns should guide all component authoring, data fetching, and caching decisions. **USE CASES**: Implementing 'use cache' directive, configuring cache lifetimes with cacheLife(), tagging cached data with cacheTag(), invalidating caches with updateTag()/revalidateTag(), optimizing static vs dynamic content boundaries, debugging cache issues, and reviewing Cache Component implementations.

138.4k