# lazy.nvim — Modern Plugin Manager for Neovim > A fast and feature-rich plugin manager for Neovim that handles lazy loading, lockfiles, profiling, and automatic builds with a clean Lua-based spec format. ## Install Save in your project root: # lazy.nvim — Modern Plugin Manager for Neovim ## Quick Use ```lua -- Bootstrap in init.lua local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not vim.uv.fs_stat(lazypath) then vim.fn.system({"git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath}) end vim.opt.rtp:prepend(lazypath) require("lazy").setup("plugins") ``` ## Introduction lazy.nvim is the standard plugin manager for modern Neovim configurations. It replaces older tools like packer.nvim with a declarative Lua spec format, automatic lazy loading based on events, commands, keymaps, and filetypes, and a built-in UI for managing and profiling plugins. ## What lazy.nvim Does - Installs, updates, and removes Neovim plugins from Git repositories and local paths - Lazy-loads plugins based on events, commands, keymaps, or filetypes automatically - Generates and maintains a lockfile (lazy-lock.json) for reproducible setups - Provides a built-in profiler showing startup time per plugin - Supports automatic post-install build steps (make, cargo, npm, etc.) ## Architecture Overview lazy.nvim stores plugins in a flat directory under stdpath("data")/lazy/. Each plugin spec is a Lua table declaring its source, dependencies, lazy-loading triggers, and configuration function. At startup, lazy.nvim reads the lockfile to verify versions, loads only the plugins whose triggers have fired, and defers the rest. The :Lazy UI provides a real-time view of plugin status, updates, and profiling data. ## Self-Hosting & Configuration - Bootstrap lazy.nvim with the snippet above in your init.lua - Define plugin specs as Lua files in a plugins/ directory - Run :Lazy sync to install, update, and clean plugins in one step - Commit lazy-lock.json to version control for reproducible environments - Requires Neovim 0.8+ and Git ## Key Features - Automatic lazy loading reduces startup to only the plugins you need at launch - Lockfile support pins exact commits for each plugin - Built-in profiler identifies slow plugins with per-plugin timing - Spec fragments let multiple files contribute to one plugin's configuration - Concurrency during install and update operations for fast package management ## Comparison with Similar Tools - **packer.nvim** — predecessor using a compile step; lazy.nvim is faster and actively maintained - **vim-plug** — Vimscript-based, simpler; lazy.nvim offers richer Lua-native lazy loading - **dein.vim** — supports caching; lazy.nvim provides a more intuitive spec format and UI - **mini.deps** — minimalist approach; lazy.nvim has more features like profiling and lockfiles - **rocks.nvim** — uses luarocks for packaging; lazy.nvim manages Git-based plugin sources directly ## FAQ **Q: How do I migrate from packer.nvim?** A: Convert your use() calls to lazy.nvim spec tables. The format is similar but uses different keys (opts instead of config, event/cmd/keys for lazy loading). **Q: Can I pin a plugin to a specific version?** A: Yes. Set the version field in the spec (e.g., version = "^2") or commit the lockfile for exact pins. **Q: How do I profile startup time?** A: Run :Lazy profile to see a ranked list of plugins by load time. **Q: Does lazy.nvim support local plugins?** A: Yes. Set dir to the local path instead of specifying a Git URL. ## Sources - https://github.com/folke/lazy.nvim - https://lazy.folke.io/ --- Source: https://tokrepo.com/en/workflows/asset-ebd5fae6 Author: AI Open Source