Plugin Management
One of the great joys of Vim and Neovim is the vibrant ecosystem of plugins built by a passionate community of developers. Whether you need a language server, a file finder, or a git client, chances are someone has already built an excellent solution -- and probably several. Managing these plugins well is what keeps your editor fast, reproducible, and easy to maintain.
Plugins extend Vim/Neovim with features like LSP support, fuzzy finding, git integration, and much more. This chapter covers modern plugin management with lazy.nvim, the current standard for Neovim.
What you'll learn in this chapter:
Install and bootstrap lazy.nvim as your plugin manager
Write plugin specs with dependencies, options, and configuration functions
Use lazy-loading strategies to keep Neovim startup fast
Manage, update, and profile your plugins using the lazy.nvim UI
lazy.nvim: The Modern Plugin Manager
lazy.nvim is the most popular plugin manager for Neovim. Key features:
Lazy loading: Plugins load only when needed, keeping startup fast
Lock file: Reproducible installs with
lazy-lock.jsonBeautiful UI: Built-in dashboard for managing plugins
Automatic compilation: No manual
:PackerCompileneededProfiling: See exactly how long each plugin takes to load
Bootstrap (Auto-install)
Add this to your init.lua or lua/config/lazy.lua (see Chapter 11: Neovim with Lua for details on Lua project structure):
This automatically installs lazy.nvim on first launch — no manual setup needed.
Plugin Spec Format
Each plugin is defined with a spec table. Create files in lua/plugins/:
Spec Options
dependencies
Plugins to install/load first
config
Function called after plugin loads
opts
Table passed to plugin's setup() function
init
Function called at startup (before loading)
lazy
true to not load at startup
event
Load on Vim event (BufReadPre, InsertEnter, etc.)
cmd
Load when running a command (:Telescope)
ft
Load for specific filetypes
keys
Load when pressing specific keys
priority
Loading order (higher = earlier)
enabled
false to disable a plugin
Lazy Loading Examples
Multiple Plugins in One File
Managing Plugins
Open the lazy.nvim UI:
I
Install missing plugins
U
Update plugins
S
Sync (install + update + clean)
X
Clean (remove unused plugins)
P
Profile (see load times)
L
View logs
Migrating from vim-plug
If you're coming from vim-plug (or a Vimscript-based configuration -- see Chapter 10: Configuring Vim & Neovim), here's how the syntax compares:
vim-plug:
lazy.nvim:
Essential Plugins for Neovim
Here's a curated list of plugins every Neovim user should consider:
Core
LSP configuration
Syntax highlighting & more
Fuzzy finder
Autocompletion
LSP/DAP/Linter installer
Editing
Add/change/delete surroundings
Toggle comments with gc
Auto-close brackets
Navigate with search labels
UI
Status line
Buffer tabs
File type icons
Key binding hints
Better UI for messages/cmdline
Git
File Management
Edit filesystem like a buffer
File explorer tree
Tip: If this seems overwhelming, try a Neovim distribution like kickstart.nvim -- a single-file config that teaches you as you read it.
Summary
Plugin management in Neovim has matured significantly with lazy.nvim, which provides automatic installation, lazy loading, lock files for reproducibility, and a built-in UI for managing updates. Combined with Lua-based plugin specs, you get a plugin system that is fast, declarative, and easy to maintain.
Key takeaways:
lazy.nvim bootstraps itself on first launch and loads plugin specs from your
lua/plugins/directory -- no manual installation step required.Lazy loading via
event,cmd,ft, andkeyskeeps startup times fast by only loading plugins when they are actually needed.The
:LazyUI lets you install, update, clean, and profile plugins from a single dashboard.The
lazy-lock.jsonlock file ensures reproducible installs across machines -- commit it to version control.
Exercises
Bootstrap lazy.nvim -- Add the lazy.nvim bootstrap snippet to your
init.lua. Restart Neovim and verify that lazy.nvim installs itself automatically by running:Lazy.Install a colorscheme plugin -- Create a plugin spec file at
lua/plugins/colorscheme.luathat installscatppuccin/nvimand sets it as the active colorscheme withpriority = 1000.Lazy-load a plugin on a command -- Write a plugin spec for
nvim-telescope/telescope.nvimthat only loads when you run:Telescopeor press<leader>ff.Create a multi-plugin spec file -- Write a single file
lua/plugins/ui.luathat returns a table containing specs for bothlualine.nvim(status line) andnvim-web-devicons(file icons), with lualine depending on devicons.Profile your startup time -- Open the lazy.nvim UI with
:Lazy, pressPto view the profile, and identify which plugin takes the longest to load. Try adding a lazy-loading trigger to that plugin.
Last updated
Was this helpful?