Skip to content

shrynx/line-numbers.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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
  • Current line highlighting for styling the numbers on the cursor line
  • Lightweight and Lua-only

screenshot

⚡️ Requirements

  • Neovim >= 0.9.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.

{
  enabled = true,     -- or false to disable by default
  mode = "both",      -- "relative", "absolute", "both", "none"
  format = "abs_rel", -- or "rel_abs"
  separator = " ",
  number_fallback = true,
  relativenumber_fallback = true,
  statuscolumn_fallback = "",
  rel_highlight = { link = "LineNr" },
  abs_highlight = { link = "LineNr" },
  current_rel_highlight = { link = "CursorLineNr" },
  current_abs_highlight = { link = "CursorLineNr" },
}
  • number_fallback, relativenumber_fallback, and statuscolumn_fallback are used only when disabling the plugin for windows whose previous values were not captured.

🔀 Commands

  • :LineNumberToggle
  • :LineNumberRelative
  • :LineNumberAbsolute
  • :LineNumberBoth
  • :LineNumberNone
  • :LineNumberPluginToggle
  • :LineNumberPluginEnable
  • :LineNumberPluginDisable

Note

Disabling the plugin restores each tracked window's previous number, relativenumber, and statuscolumn values that are saved when the plugin is enabled.

📚 Help

After installation, run:

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

About

A Neovim plugin to display both relative and absolute line numbers side-by-side

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages