Skip to main content

Getting Started (Neovim)

Colorscheming with Catppuccin!

Now you may look at what's on your screen now and think it looks good enough. We've got Neovim installed, Lua is just roaring to get plugins installed for us. We've made progress.

But does it look good?

We're not living in the 1980s. No monochrome screens here, so let's not live like it.

TRS-80 looking for for the 80s

It's time to do some colorscheming!

Now I love this colorscheme that we're going to install is called catppuccin. With amazing color defaults and a great palette.

To install it, we can visit the Github repo specific for Neovim. It's a breeze to add by looking for lazy.nvim in the install section of the docs.

That looks like this...

{ "catppuccin/nvim", name = "catppuccin", priority = 1000 }

Well, what do we do with that ?!?

Let's break it down. This Lua table starts with the name of the Github repo. This is standard for how you'll install plugins so anytime you have to install, you'll grab the short URL for the repo and put that as the first parameter in the Lua table.

The second argument is the name. This is mostly for readability. Later, when one plugin is dependent on another, being able to reference by name can make it easier to know what each dep is doing.

Priority can be important to ensure the order of plugins is loaded is correct. For a colorscheme, this is important so that the colors don't appear as the default and then switch when Catppuccin is loaded.


Now that you understand the install line, where do we put it?

Let's go back to our ~/.config/nvim/init.lua file.

Remember that plugins section? It looked like this.

local opts = {}
local plugins = {}

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

It's time to start filling this out to load some plugins!

First we'll update the plugins table.

local plugins = {
  { "catppuccin/nvim", name = "catppuccin", priority = 1000 }
}

Here, you can see that we're nesting a Lua table within plugins. Now when we reload Neovim, Lazy will see that we have an uninstalled package and it'll take care of it.

Awesome !

But wait, the theme isn't showing up — what gives?

This is gross

We haven't setup the package. Most Neovim packages will have a setup function that you call.

When you do, the following things happen.

  1. Initialization: sets up the plugin with user-specified settings or defaults. Thank key mappings, defining global variables...
  2. Configuration: typically, the setup function will take options to configure the plugin.
  3. Lazy loading support: you can define when a plugin should be loaded so lazy loading can happen correctly.

We've already seen this once before with Lazy.

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

Now let's do the same with Catppuccin.

--require catppuccin
require("catppuccin").setup()

--set the colorscheme to it!
vim.cmd.colorscheme "catppuccin"

Let's close Neovim, reopen it, and BOOM — looking good already.

Final init.lua