Awesome
relative-toggle.nvim
Neovim plugin to automatically toggling between relative and absolute line numbers in Neovim.
Installation
lazy.nvim
{
"togawalk/relative-toggle.nvim",
opts = {
-- your configuration comes here
-- or leave it empty to use the default settings
}
}
Configuration
relative-toggle.nvim comes with the following defaults:
{
relativenumber = true,
pattern= "*",
events = {
on = { "BufEnter", "FocusGained", "InsertLeave", "WinEnter", "CmdlineLeave" },
off = { "BufLeave", "FocusLost", "InsertEnter", "WinLeave", "CmdlineEnter" },
},
}
Usage
Toggle relative numbers with :ToggleRelativeNumber
.
or
-- -- line numbers
vim.keymap.set("n", "<leader>rn", "<cmd> ToggleRelativeNumber <CR>", { desc = "Toggle relative number" })