Neovim from Scratch - Part 1: lazy.nvim, kanagawa.nvim, oil.nvim, Statusline & Essential Settings

3 min read 1 month ago
Published on Jul 26, 2025 This response is partially generated with the help of AI. It may contain inaccuracies.

Table of Contents

Introduction

This tutorial guides you through the process of setting up a robust Neovim configuration from scratch, focusing on essential features for an efficient development environment. We will cover the installation of a package manager, configuration of themes, file management, and custom settings to enhance your Neovim experience.

Step 1: Install lazy.nvim Package Manager

  1. Open your terminal and navigate to your Neovim configuration directory, typically ~/.config/nvim/.
  2. Create a new file called init.lua if it doesn't exist.
  3. Add the following code to install lazy.nvim:
    -- 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)
    

Step 2: Configure Essential Settings

  1. Add basic settings to your init.lua to enhance usability:

    -- Basic settings
    vim.opt.number = true
    vim.opt.relativenumber = true
    vim.opt.mouse = "a"  -- Enable mouse support
    vim.opt.splitbelow = true  -- Split windows below
    vim.opt.splitright = true  -- Split windows to the right
    
  2. Setup automatic indentation detection:

    vim.opt.autoindent = true
    vim.opt.smartindent = true
    

Step 3: Install and Configure kanagawa.nvim Theme

  1. Add kanagawa.nvim to your plugins in init.lua:

    require("lazy").setup({
        { "rebelot/kanagawa.nvim" }
    })
    
  2. Set the theme after loading the plugins:

    require("kanagawa").setup()
    vim.cmd("colorscheme kanagawa")
    

Step 4: Install and Configure oil.nvim File Manager

  1. Add oil.nvim to your plugins:

    require("lazy").setup({
        { "stevearc/oil.nvim" }
    })
    
  2. Replace the default file explorer:

    vim.keymap.set("n", "-", require("oil").open, { desc = "Open parent directory" })
    

Step 5: Customize Statusline

  1. Install a statusline plugin (e.g., lualine):

    require("lazy").setup({
        { "nvim-lualine/lualine.nvim" }
    })
    
  2. Set up the statusline:

    require("lualine").setup({
        options = {
            theme = "kanagawa",
            section_separators = '',
            component_separators = '',
        }
    })
    

Step 6: Configure Git Integration in Sign Columns

  1. Add Git signs for better visibility:

    require("lazy").setup({
        { "lewis6991/gitsigns.nvim" }
    })
    
  2. Enable Git signs:

    require("gitsigns").setup()
    

Conclusion

You have successfully set up a foundational Neovim configuration with lazy.nvim as your package manager, implemented the kanagawa.nvim theme, replaced netrw with oil.nvim, and customized your statusline. This configuration enhances your development environment, making it more user-friendly and efficient.

For further enhancements, consider exploring advanced features like Treesitter for syntax highlighting and LSP for code intelligence in upcoming episodes of this series. Your next steps could include diving into those features or refining your current setup to better suit your workflow.