Skip to main content

Getting Started (Neovim)

Package Manager Setup: Lazy.nvim

To get to IDE-level status, we're going to need a package manager. In this series, we're going to use Lazy. From our experience, Lazy and Packer are very similar but lazy is a touch faster to load. Lazy (as the name implies) will lazily load packages. This is important for performance.

Before we set it up though, what are packages?

Well, packages in Neovim provide a structured method to manage additional functionality and plugins that extend the core capabilities of Neovim, a highly configurable text editor built for efficient text editing. These packages can include various enhancements, such as syntax highlighting for additional programming languages, code completion tools, file system explorers, and more.

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", -- latest stable release
    lazypath,
  })
end
vim.opt.rtp:prepend(lazypath)

local opts = {}
local plugins = {}

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

The above will check to see if Lazy is present. If it isn't, it'll clone it from Github.

The next section defines some lua tables (not tuples!) for opts and plugins.

The final line require("lazy").setup(plugins, opts) will be really important when it comes to adding plugins. More on that soon.

Now we'll write the file with :w and source the file using :source %.

Did that do anything? Let's find out by running the command :Lazy.

Now we should see the GUI for Lazy. Time to install some packages!