C.W.K.
Stream
Lesson 03 of 04 · published

Plugin Management with lazy.nvim

~14 min · neovim, lazy, plugins

Level 0Trapped
0 XP0/35 lessons0/12 achievements
0/100 XP to next level100 XP to go0% complete

The modern standard for Neovim plugins

lazy.nvim (folke/lazy.nvim) is the de-facto plugin manager for Neovim in 2026. It supports lazy-loading (load plugins on events / commands / filetypes), automatic install on startup, lockfile-based reproducibility, and a clean interactive UI for status and profiling.

Bootstrap — the standard snippet

The bootstrap goes at the top of your init.lua. It checks if lazy.nvim is installed; if not, it git-clones it. Then require("lazy").setup(plugins) takes over and installs everything else.

Plugin specs

Each plugin is a Lua table with a string (the GitHub user/repo) and optional fields:

  • dependencies — other plugins this needs.
  • config — function to call after the plugin loads (usually require("plugin").setup({...})).
  • opts — shorthand for the common case where the config is just require("plugin").setup(opts).
  • event — load on a specific event (BufReadPost, InsertEnter, VeryLazy).
  • cmd — load when a command is first used.
  • ft — load only for specific filetypes.
  • keys — load when a key is first pressed.
  • build — shell command after install (e.g. :TSUpdate for treesitter).

The starter plugin set

Six plugins cover ~80% of what most people install:

  • nvim-treesitter — accurate AST-based syntax highlighting, structural text objects.
  • telescope.nvim — fuzzy finder for files, grep, buffers, LSP symbols, everything.
  • nvim-lualine — pretty status line.
  • which-key.nvim — popup menu for your leader keymap as you type.
  • nvim-autopairs — autoclose brackets and quotes.
  • nvim-surroundys / ds / cs operations on surrounding pairs.
Live in :Lazy. The lazy.nvim UI shows load times for every plugin, lets you update / clean / sync, and highlights breakage. Run :Lazy profile after install — you'll see exactly which plugins cost startup time.

Code

Bootstrap lazy.nvim — paste verbatim at the top of init.lua·lua
-- Bootstrap lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).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)

-- Set leader BEFORE lazy.setup so plugin keys work
vim.g.mapleader = " "
vim.g.maplocalleader = " "
The starter plugin set·lua
require("lazy").setup({
  -- Treesitter — better highlighting + textobjects
  {
    "nvim-treesitter/nvim-treesitter",
    build = ":TSUpdate",
    config = function()
      require("nvim-treesitter.configs").setup({
        ensure_installed = {
          "lua", "python", "javascript", "typescript",
          "html", "css", "json", "yaml", "bash",
          "markdown", "markdown_inline", "vim", "vimdoc",
        },
        highlight = { enable = true },
        indent = { enable = true },
      })
    end,
  },

  -- Telescope — fuzzy finder
  {
    "nvim-telescope/telescope.nvim",
    dependencies = { "nvim-lua/plenary.nvim" },
    keys = {
      { "<leader>ff", "<cmd>Telescope find_files<CR>", desc = "Find files" },
      { "<leader>fg", "<cmd>Telescope live_grep<CR>", desc = "Live grep" },
      { "<leader>fb", "<cmd>Telescope buffers<CR>", desc = "Buffers" },
      { "<leader>fh", "<cmd>Telescope help_tags<CR>", desc = "Help" },
    },
  },

  -- Status line
  { "nvim-lualine/lualine.nvim", opts = { options = { theme = "auto" } } },

  -- Which-key (leader popup)
  { "folke/which-key.nvim", event = "VeryLazy", opts = {} },

  -- Autopairs
  { "windwp/nvim-autopairs", event = "InsertEnter", config = true },

  -- Surround
  { "kylechui/nvim-surround", event = "VeryLazy", config = true },
})
Lazy.nvim UI commands·vim
:Lazy           " open the UI
:Lazy sync      " install + update + clean
:Lazy update    " update only
:Lazy clean     " remove unused plugins
:Lazy profile   " startup timing per plugin
:Lazy log       " view recent updates

External links

Exercise

Add the bootstrap snippet and the starter plugin set to your init.lua. Restart Neovim — lazy.nvim should clone and install everything automatically. Open :Lazy to verify all six plugins are loaded. Press <Space>ff to test telescope's find-files. If something fails, read the bottom of :Lazy log — error messages are clear.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.