โ† Back to overview

Plugins and the Plugin Ecosystem

Plugin Manager: lazy.nvim

The most popular modern plugin manager is lazy.nvim. It supports lazy-loading (plugins load only when needed), which keeps startup fast.

Setup

Create ~/.config/nvim/lua/plugins/init.lua:

-- Bootstrap lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not 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)

-- Load plugins
require("lazy").setup({
  -- Plugin specifications go here
  -- Each plugin is typically a separate file in lua/plugins/
}, {
  defaults = { lazy = true },  -- Lazy-load by default
})

Then in init.lua:

require("plugins")

Essential Plugins

Colorscheme

-- In a plugin spec file
{
  "catppuccin/nvim",
  name = "catppuccin",
  priority = 1000,  -- Load first
  config = function()
    vim.cmd.colorscheme("catppuccin-mocha")
  end,
}

Status Line

{
  "nvim-lualine/lualine.nvim",
  dependencies = { "nvim-tree/nvim-web-devicons" },
  config = function()
    require("lualine").setup()
  end,
}

File Explorer

{
  "nvim-tree/nvim-tree.lua",
  dependencies = { "nvim-tree/nvim-web-devicons" },
  keys = {
    { "<leader>e", "<cmd>NvimTreeToggle<cr>", desc = "Toggle file explorer" },
  },
  config = function()
    require("nvimtree").setup()
  end,
}

Which-Key (Keybinding Helper)

{
  "folke/which-key.nvim",
  event = "VeryLazy",
  config = function()
    require("which-key").setup()
  end,
}

Built-in Terminal

Neovim has a built-in terminal emulator. This is one of its killer features.

CommandAction
:terminal or :termOpen terminal in a new window
:split term://bashOpen terminal in horizontal split
:vsplit term://zshOpen terminal in vertical split

Terminal Mode

When the terminal is open, you are in Terminal-Job mode (behaves like a normal terminal). To use Neovim commands:

  • Ctrl-\ Ctrl-N โ€” Switch to Normal mode from terminal
  • From Normal mode, you can scroll, copy, and navigate the terminal output

Useful Terminal Mappings

-- Escape terminal mode with Esc
vim.keymap.set("t", "<Esc><Esc>", "<C-\\><C-n>", { desc = "Exit terminal mode" })

-- Open terminal
vim.keymap.set("n", "<leader>t", function()
  vim.cmd("split | terminal")
  vim.cmd("startinsert")
end, { desc = "Open terminal" })