Skip to content
shrynx edited this page Apr 21, 2025 · 1 revision

line-numbers.nvim

A Neovim plugin to display both relative and absolute line numbers side-by-side using the statuscolumn feature (requires Neovim 0.9+).

✨ Features

  • Show relative, absolute, both, or no line numbers
  • Configurable format (abs_rel or rel_abs)
  • Custom separator between numbers
  • Highlight groups for styling relative and absolute numbers
  • Lightweight and Lua-only

screenshot

⚡️ Requirements

  • Neovim >= 0.10.0
  • lazy.nvim plugin manager
    • OR a plugin manager that uses Neovim's native package system

📦 Installation

With lazy.nvim:

{
  "shrynx/line-numbers.nvim",
  opts = {},
}
use({
  "shrynx/line-numbers.nvim",
  config = function()
    require("line-numbers").setup({})
  end
})

⚙️ Options

All the options are optional and below are the defaults.

{
  mode = "both",      -- "relative", "absolute", "both", "none"
  format = "abs_rel", -- or "rel_abs"
  separator = " ",
  rel_highlight = { link = "LineNr" },
  abs_highlight = { link = "LineNr" },
}

🔀 Commands

  • :LineNumberToggle
  • :LineNumberRelative
  • :LineNumberAbsolute
  • :LineNumberBoth
  • :LineNumberNone

📚 Help

After installation, run:

:helptags ~/.local/share/nvim/lazy/line-numbers.nvim/doc
:help line-numbers