Skip to main content

Overview

Lualine is a blazing fast and highly customizable statusline plugin for Neovim. The Magictt config uses a custom color scheme that changes based on the current Neovim mode, providing visual feedback about your editor state.

What Lualine Does

  • Mode Indicator: Shows the current Neovim mode (Normal, Insert, Visual, etc.) with color-coded sections
  • File Information: Displays file encoding, format, and type
  • Plugin Status: Shows pending Lazy.nvim updates
  • Git Integration: Displays branch and diff information
  • LSP Status: Shows active language servers

Configuration

The full lualine configuration from the source:
return {
  "nvim-lualine/lualine.nvim",
  dependencies = { "nvim-tree/nvim-web-devicons" },
  config = function()
    local lualine = require("lualine")
    local lazy_status = require("lazy.status") -- to configure lazy pending updates count

    local colors = {
      blue = "#65D1FF",
      green = "#3EFFDC",
      violet = "#FF61EF",
      yellow = "#FFDA7B",
      red = "#FF4A4A",
      fg = "#c3ccdc",
      bg = "#112638",
      inactive_bg = "#2c3043",
    }

    local my_lualine_theme = {
      normal = {
        a = { bg = colors.blue, fg = colors.bg, gui = "bold" },
        b = { bg = colors.bg, fg = colors.fg },
        c = { bg = colors.bg, fg = colors.fg },
      },
      insert = {
        a = { bg = colors.green, fg = colors.bg, gui = "bold" },
        b = { bg = colors.bg, fg = colors.fg },
        c = { bg = colors.bg, fg = colors.fg },
      },
      visual = {
        a = { bg = colors.violet, fg = colors.bg, gui = "bold" },
        b = { bg = colors.bg, fg = colors.fg },
        c = { bg = colors.bg, fg = colors.fg },
      },
      command = {
        a = { bg = colors.yellow, fg = colors.bg, gui = "bold" },
        b = { bg = colors.bg, fg = colors.fg },
        c = { bg = colors.bg, fg = colors.fg },
      },
      replace = {
        a = { bg = colors.red, fg = colors.bg, gui = "bold" },
        b = { bg = colors.bg, fg = colors.fg },
        c = { bg = colors.bg, fg = colors.fg },
      },
      inactive = {
        a = { bg = colors.inactive_bg, fg = colors.semilightgray, gui = "bold" },
        b = { bg = colors.inactive_bg, fg = colors.semilightgray },
        c = { bg = colors.inactive_bg, fg = colors.semilightgray },
      },
    }

    -- configure lualine with modified theme
    lualine.setup({
      options = {
        theme = my_lualine_theme,
      },
      sections = {
        lualine_x = {
          {
            lazy_status.updates,
            cond = lazy_status.has_updates,
            color = { fg = "#ff9e64" },
          },
          { "encoding" },
          { "fileformat" },
          { "filetype" },
        },
      },
    })
  end,
}
Source: lua/magictt/plugins/lualine.lua:1-72

Color Scheme

The custom theme uses different colors for each mode:
ModeColorHex CodeVisual Indicator
NormalBlue#65D1FFLeft section background
InsertGreen#3EFFDCLeft section background
VisualViolet#FF61EFLeft section background
CommandYellow#FFDA7BLeft section background
ReplaceRed#FF4A4ALeft section background
InactiveDark Gray#2c3043All sections when window is inactive

Base Colors

  • Foreground: #c3ccdc (Light gray text)
  • Background: #112638 (Dark blue-gray background)
  • Update Indicator: #ff9e64 (Orange for pending updates)

Statusline Sections

Lualine is divided into sections from left to right:

Left Side (lualine_a, lualine_b, lualine_c)

  • Section A: Current mode (NORMAL, INSERT, VISUAL, etc.)
  • Section B: Git branch and diff stats
  • Section C: File name and modified status

Right Side (lualine_x, lualine_y, lualine_z)

  • Section X (custom):
    • Lazy.nvim pending updates (when available)
    • File encoding (e.g., utf-8)
    • File format (e.g., unix, dos)
    • File type (e.g., lua, python)
  • Section Y: File progress (percentage through file)
  • Section Z: Current line and column number

Lazy.nvim Integration

The statusline shows when plugin updates are available:
{
  lazy_status.updates,
  cond = lazy_status.has_updates,
  color = { fg = "#ff9e64" },
}
This displays an orange indicator in the statusline when Lazy.nvim has pending plugin updates.

Usage

Understanding Mode Colors

Watch the left section of your statusline:
  • Blue: You’re in Normal mode (ready for navigation)
  • Green: You’re in Insert mode (typing)
  • Violet: You’re in Visual mode (selecting text)
  • Yellow: You’re in Command mode (entering commands)
  • Red: You’re in Replace mode (overwriting text)

Checking Plugin Updates

When you see an orange indicator in the right section:
  1. It means Lazy.nvim has detected available updates
  2. Press <leader>l to open the Lazy menu
  3. Press U to update plugins

File Information

The right section shows:
[lazy updates] utf-8 unix lua 85% 45:12
  • lazy updates: Pending plugin updates (if any)
  • utf-8: File encoding
  • unix: Line ending format
  • lua: File type
  • 85%: You’re 85% through the file
  • 45:12: Cursor at line 45, column 12

Customization

Changing Colors

To modify the color scheme, edit the colors table in lua/magictt/plugins/lualine.lua:8-17:
local colors = {
  blue = "#65D1FF",    -- Normal mode
  green = "#3EFFDC",   -- Insert mode
  violet = "#FF61EF",  -- Visual mode
  yellow = "#FFDA7B",  -- Command mode
  red = "#FF4A4A",     -- Replace mode
  fg = "#c3ccdc",      -- Text color
  bg = "#112638",      -- Background
  inactive_bg = "#2c3043",
}

Adding Components

To add new components to the statusline, modify the sections table in lua/magictt/plugins/lualine.lua:57-68:
sections = {
  lualine_x = {
    -- Add your custom components here
    { "diagnostics" },  -- LSP diagnostics
    { "diff" },         -- Git diff
    -- ... existing components
  },
}

Using a Different Theme

To use a built-in lualine theme instead of the custom one:
lualine.setup({
  options = {
    theme = "auto",  -- or "gruvbox", "tokyonight", etc.
  },
})

Tips and Tricks

Hiding Sections

To hide specific sections, set them to empty:
sections = {
  lualine_x = {},  -- Hide right section
}

Conditional Components

Add components that only show under certain conditions:
{
  function()
    return "🔥"
  end,
  cond = function()
    return vim.bo.modified
  end,
}
This shows a fire emoji only when the file is modified.

LSP Status

To show active LSP clients:
{
  function()
    local clients = vim.lsp.get_active_clients()
    if next(clients) == nil then
      return "No LSP"
    end
    local names = {}
    for _, client in ipairs(clients) do
      table.insert(names, client.name)
    end
    return table.concat(names, ", ")
  end,
}

Git Branch

Lualine automatically shows git branch in section B. To customize:
sections = {
  lualine_b = {
    { "branch", icon = "" },
    { "diff" },
  },
}

Diagnostics Count

Show LSP diagnostic counts:
{
  "diagnostics",
  sources = { "nvim_lsp" },
  sections = { "error", "warn", "info", "hint" },
  symbols = { error = " ", warn = " ", info = " ", hint = " " },
}

Performance

Lualine is highly optimized:
  • Updates only when necessary
  • Minimal performance impact
  • Lazy-loads components
  • Efficient redrawing

No Keybindings

Lualine is a visual plugin that doesn’t have keybindings. It passively displays information in the statusline.
  • Which-key - Keybinding reference for accessing plugin menus
  • Bufferline - Tab/buffer line at the top

External Resources

Build docs developers (and LLMs) love