lazy.nvim installation and configuration
How to setup the lazy.vim as your Neovim plugin manager

For a long time, packer.nvim was the de facto plugin manager for Neovim. It offered a clean Lua-based configuration, fast startup times, and an approachable API that helped many users transition from Vimscript to a more modern Neovim setup. However, with packer now discontinued and no longer maintained, the Neovim ecosystem has naturally moved on in search of a replacement that embraces newer design ideas and performance improvements.
Enter lazy.nvim. Designed from the ground up with modern Neovim workflows in mind, lazy.nvim goes beyond simply installing plugins. It introduces automatic lazy loading by default, event-based loading, and a highly optimized startup path, which often results in faster launch times with less manual configuration. While packer required you to explicitly define when and how plugins should be loaded, lazy.nvim encourages a declarative style that scales better as your configuration grows. In this post, we’ll walk through how to install and configure lazy.nvim.
First things first. You can install Neovim using the following commands for Windows or macOS. For Linux distributions, please refer to the neovim documentation, where you can find the specific command line for the package manager corresponding to most Linux distributions.
Windows
winget install Neovim.Neovim
macOS
brew install neovim
Once the installation completes successfully, you can start Neovim from your terminal by running the following command:
nvim
This will launch Neovim and display its default welcome screen, confirming that the editor is installed correctly and ready to be configured. From here, we can begin customizing Neovim and setting up our development environment:

The next step is to create the root nvim directory that will contain your Neovim configuration files. The exact location of this directory depends on the operating system, but on Windows and macOS, it can be found at the following path:
Windows:
mkdir ~\AppData\Local\nvimmacOS:
mkdir ~/.config/nvim
There are many ways to structure Neovim configuration files, but a clean and common approach is to use a bootstrap file called init.lua, along with a lua/config directory for core Neovim settings. In addition, a lua/plugins directory can be used to store one specification file per plugin you want to configure:

The init.lua file serves as a bootstrap that triggers lazy.nvim, which in turn will load all the plugins you have configured. To set this up, create the init.lua file and add the following content:
-- nvim/init.lua
require("config.lazy")
In a Neovim (Lua) configuration, require is how you load and use Lua modules. It’s equivalent to “importing” code so you can reuse it across files. In this case, it loads the module that´s located at nvim/lua/config/lazy.lua. Therefore, we need to create that file:
-- Bootstrap lazy.nvim
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)
-- Setup lazy.nvim
require("lazy").setup({
spec = {
-- import your plugins
{ import = "plugins" },
},
-- automatically check for plugin updates
checker = { enabled = true },
})
This file does three critical things:
Installs lazy.nvim automatically if it’s missing
Adds it to Neovim’s runtime
Configures it to load plugins from
lua/plugins/
We’ve configured the plugins directory as the location where Neovim should look for plugin specifications. Since no plugins are defined yet, starting Neovim at this stage would result in an error complaining about missing specs. To prevent this, we’ll create our first plugin specification. A good candidate is nvim-lspconfig, one of the most important plugins, as it enables support for Neovim’s built-in LSP client. To do this, we’ll add a simple placeholder for nvim-lspconfig in the file nvim/lua/plugins/lsp.lua:
-- nvim/lua/plugins/lsp.lua placeholder
return {
}
At this point, we can start Neovim again and run the :Lazy command. This opens the interface of lazy.nvim, where you should see the plugin listed, confirming that lazy.nvim has been set up correctly and is managing your plugins as expected. From this window, you can also inspect plugin status, trigger installations, and manage updates, giving you a clear overview of your Neovim plugin ecosystem:

And that’s all for the initial setup of lazy.nvim. With the plugin manager now in place, we’re ready to move on to configuring actual plugins. In the next post, we’ll take the first step in that direction by setting up nvim-lspconfig and enabling Neovim’s built-in Language Server Protocol support. See you in the next one!



