Add nvim colorizer

This commit is contained in:
Buliway 2025-03-20 17:05:10 +03:00
parent ede97c4a12
commit e962e74f97
4 changed files with 67 additions and 4 deletions

View file

@ -91,6 +91,9 @@ require('lazy').setup({
-- Plugins for git
require 'custom.plugins.git',
-- Plugins for color highlight
require 'custom.plugins.colorizer',
-- Autoformat markdown tables
{
'Kicamon/markdown-table-mode.nvim',

View file

@ -34,6 +34,7 @@
"nui.nvim": { "branch": "main", "commit": "8d3bce9764e627b62b07424e0df77f680d47ffdb" },
"nvim-autopairs": { "branch": "master", "commit": "68f0e5c3dab23261a945272032ee6700af86227a" },
"nvim-cmp": { "branch": "main", "commit": "1e1900b0769324a9675ef85b38f99cca29e203b3" },
"nvim-colorizer.lua": { "branch": "master", "commit": "517df88cf2afb36652830df2c655df2da416a0ae" },
"nvim-dap": { "branch": "master", "commit": "a720d4966f758ab22e8ec28812b6df90a53e0f02" },
"nvim-dap-go": { "branch": "main", "commit": "8763ced35b19c8dc526e04a70ab07c34e11ad064" },
"nvim-dap-ui": { "branch": "master", "commit": "bc81f8d3440aede116f821114547a476b082b319" },

View file

@ -0,0 +1,63 @@
-- A high-performance color highlighter
return {
{
'catgoose/nvim-colorizer.lua',
event = 'BufReadPre',
opts = { -- set to setup table
filetypes = { '*' }, -- Filetype options. Accepts table like `user_default_options`
buftypes = {}, -- Buftype options. Accepts table like `user_default_options`
-- Boolean | List of usercommands to enable. See User commands section.
user_commands = true, -- Enable all or some usercommands
lazy_load = false, -- Lazily schedule buffer highlighting setup function
user_default_options = {
names = true, -- "Name" codes like Blue or red. Added from `vim.api.nvim_get_color_map()`
names_opts = { -- options for mutating/filtering names.
lowercase = true, -- name:lower(), highlight `blue` and `red`
camelcase = true, -- name, highlight `Blue` and `Red`
uppercase = false, -- name:upper(), highlight `BLUE` and `RED`
strip_digits = false, -- ignore names with digits,
-- highlight `blue` and `red`, but not `blue3` and `red4`
},
-- Expects a table of color name to #RRGGBB value pairs. # is optional
-- Example: { cool = "#107dac", ["notcool"] = "ee9240" }
-- Set to false to disable, for example when setting filetype options
names_custom = false, -- Custom names to be highlighted: table|function|false
RGB = true, -- #RGB hex codes
RGBA = true, -- #RGBA hex codes
RRGGBB = true, -- #RRGGBB hex codes
RRGGBBAA = false, -- #RRGGBBAA hex codes
AARRGGBB = false, -- 0xAARRGGBB hex codes
rgb_fn = false, -- CSS rgb() and rgba() functions
hsl_fn = false, -- CSS hsl() and hsla() functions
css = false, -- Enable all CSS *features*:
-- names, RGB, RGBA, RRGGBB, RRGGBBAA, AARRGGBB, rgb_fn, hsl_fn
css_fn = false, -- Enable all CSS *functions*: rgb_fn, hsl_fn
-- Tailwind colors. boolean|'normal'|'lsp'|'both'. True sets to 'normal'
tailwind = false, -- Enable tailwind colors
tailwind_opts = { -- Options for highlighting tailwind names
update_names = false, -- When using tailwind = 'both', update tailwind names from LSP results. See tailwind section
},
-- parsers can contain values used in `user_default_options`
sass = { enable = false, parsers = { 'css' } }, -- Enable sass colors
-- Highlighting mode. 'background'|'foreground'|'virtualtext'
mode = 'background', -- Set the display mode
-- Virtualtext character to use
virtualtext = '',
-- Display virtualtext inline with color. boolean|'before'|'after'. True sets to 'after'
virtualtext_inline = false,
-- Virtualtext highlight mode: 'background'|'foreground'
virtualtext_mode = 'foreground',
-- update color values even if buffer is not focused
-- example use: cmp_menu, cmp_docs
always_update = false,
-- hooks to invert control of colorizer
hooks = {
-- called before line parsing. Accepts boolean or function that returns boolean
-- see hooks section below
disable_line_highlight = false,
},
},
},
},
}

View file

@ -17,10 +17,6 @@ local function session_name()
local branch = get_git_branch()
local name = cwd
-- if branch then
-- name = name .. '-' .. branch
-- end
local sha = vim.fn.sha256(name)
if branch then