A Neovim plugin to display both relative and absolute line numbers side-by-side using the statuscolumn
feature (requires Neovim 0.9+).
- Show relative, absolute, both, or no line numbers
- Configurable format (
abs_rel
orrel_abs
) - Custom separator between numbers
- Highlight groups for styling relative and absolute numbers
- Current line highlighting for styling the numbers on the cursor line
- Lightweight and Lua-only
- Neovim >= 0.9.0
- lazy.nvim plugin manager
- OR a plugin manager that uses Neovim's native package system
With lazy.nvim:
{
"shrynx/line-numbers.nvim",
opts = {},
}
With packer.nvim:
use({
"shrynx/line-numbers.nvim",
config = function()
require("line-numbers").setup({})
end
})
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" },
current_rel_highlight = { link = "CursorLineNr" },
current_abs_highlight = { link = "CursorLineNr" },
}
- :LineNumberToggle
- :LineNumberRelative
- :LineNumberAbsolute
- :LineNumberBoth
- :LineNumberNone
After installation, run:
:helptags ~/.local/share/nvim/lazy/line-numbers.nvim/doc
:help line-numbers