Neovim plugin for quick visual hints of relative distances from your cursor
- Colors require less mental bandwidth to parse than a long list of numbers
- Zip around files quickly, just like a rainbow does.
{
'fluxdiv/relative-rainbow.nvim',
config = function()
require("relative-rainbow").setup()
end
}use {
'fluxdiv/relative-rainbow.nvim',
config = function()
require("relative-rainbow").setup()
end
}To use the default config just call .setup() with no params/nil (see ./lua/relative-rainbow/config/defaults.lua)
require("relative-rainbow").setup()relative-rainbow.nvim includes multiple template configs (see ./lua/relative-rainbow/config/templates/)
{
'fluxdiv/relative-rainbow.nvim',
config = function()
local grayscale_templates = require("relative-rainbow.config.templates.grayscale")
-- require("relative-rainbow").setup(grayscale_templates.grayscale_tint_line)
local rainbow_templates = require("relative-rainbow.config.templates.rainbow")
-- require("relative-rainbow").setup(rainbow_templates.rainbow_line_dark)
local misc_templates = require("relative-rainbow.config.templates.misc")
require("relative-rainbow").setup(misc_templates.cyberpunk)
end
}You can customize your config by passing a table of config options to .setup(). Each entry represents a "step" and supports the following fields:
distance_from_cursor(number): Distance from cursor to apply highlighthl_target("number_column"|"editor"|"both"|nil): Where to apply highlight. Defaults to"both". See example images for more detailsfill(boolean): Iftrue, highlights the entire range. Iffalseonly highlights the 2 individual lines @distance_from_cursor. Defaults totruebg(string|nil): Solid background color in hex (ex "#FF0000") Overridesbg_tintif providedbg_tint(string|nil): Apply a tint color to current theme's bg (instead of a solid color)bg_tint_multiplier(number|nil): Strength of bg tint (between 0 and 1). Larger = stronger tintfg(string|nil): Solid fg color in hex. Overridesfg_tintif providedfg_tint(string|nil): Apply a tint color to current theme's fgfg_tint_multiplier(number|nil): Strength of fg tint (between 0 and 1). Larger = stronger tint
{
'fluxdiv/relative-rainbow.nvim',
config = function()
require("relative-rainbow").setup({
-- Entry with all fields provided
{
distance_from_cursor = 5,
hl_target = "both",
fill = false,
-- "bg" overrides "bg_tint" and "bg_tint_multiplier"
bg = "#FF0000",
bg_tint = "#000000",
bg_tint_multiplier = 0.1,
-- "fg" overrides "fg_tint" and "fg_tint_multiplier"
fg = "#FF0000",
fg_tint = "#000000",
fg_tint_multiplier = 0.99,
},
-- Individual highlights for editor & number_column at same distance (same lines)
{
distance_from_cursor = 11,
hl_target = "editor",
bg_tint = "#000000",
},
{
distance_from_cursor = 11,
hl_target = "number_column",
fg = "#00FFD0",
fill = false,
},
})
end
}