VimSenseiStartarrow_forward
/ setup guide·4 min read·beginner

Bootstrap lazy.nvim.

One Lua snippet turns a bare Neovim into a plugin-ready editor. Here's the exact bootstrap code, where it goes, and how to confirm it's alive — before you write a single plugin spec.

/ 01

What you need first

lazy.nvim needs Neovim 0.9 or later — it leans on APIs vanilla Vim doesn't have. Check what you're running:

// snippet
nvim --version | head -1

Don't have Neovim yet? Install it first, then come back here.

/ 02

Set up the config skeleton

lazy.nvim expects a specific layout: one file that bootstraps lazy itself, and a folder it scans for plugin specs. This is the same layout lesson 27 and 28 use, so what you build here matches what you'll see there.

  1. 01

    Create the folders

    // snippet
    mkdir -p ~/.config/nvim/lua/config
    mkdir -p ~/.config/nvim/lua/plugins
    touch ~/.config/nvim/init.lua

    lua/config/ holds editor-wide setup (the lazy bootstrap goes here). lua/plugins/ stays mostly empty for now — lazy auto-loads any file dropped in later, one plugin per file.

/ 03

The bootstrap snippet

This is the official lazy.nvim bootstrap, straight from their README: it clones lazy.nvim itself the first time Neovim starts, bails out with a real error message if the clone fails instead of continuing with a broken runtimepath, then hands control to it.

// ~/.config/nvim/lua/config/lazy.lua
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
  vim.api.nvim_echo({
    { "Failed to clone lazy.nvim:\n", "ErrorMsg" },
    { out, "WarningMsg" },
    { "\nPress any key to exit..." },
  }, true, {})
  vim.fn.getchar()
  os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)

require("lazy").setup("plugins")

vim.uv or vim.loop covers both current and older Neovim versions — vim.loop was renamed to vim.uv in 0.10, and this line works either way. The last line is the important one for you — require("lazy").setup("plugins") tells lazy to scan lua/plugins/ for spec files. Now wire it into init.lua:

// ~/.config/nvim/init.lua
require("config.lazy")
/ 04

Verify it's alive

Open Neovim. The first launch clones lazy.nvim itself, which takes a second or two.

~/.config/nvimready
$ nvim
:Lazy                                  // opens the lazy.nvim UI
// "0 plugins" — nothing in lua/plugins/ yet, and that's correct
:q                                     // close the Lazy window

If :Lazy opens at all, the bootstrap worked. An empty plugin list isn't a bug — you haven't dropped any spec files into lua/plugins/ yet.

/ 05

Now practice

You own a real lua/config/lazy.lua now — the exact wiring every plugin you add later depends on.

/ Helpful?

Was this guide useful? One tap, no signup needed.

/ 05 — Now Practice

New keybinding → new muscle memory.

Reading only gets you so far. Your fingers need reps.