From 3aa7d1d6f8144390a906f511b50be643bcfc1ba2 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Mon, 2 Feb 2026 13:22:22 -0500 Subject: [PATCH 1/6] feat: use conceal overlay --- doc/fugitive-ts.nvim.txt | 12 +++++------- lua/fugitive-ts/highlight.lua | 9 ++++----- lua/fugitive-ts/init.lua | 12 ++++++++---- spec/highlight_spec.lua | 26 +++++++++++++------------- spec/init_spec.lua | 2 +- 5 files changed, 31 insertions(+), 30 deletions(-) diff --git a/doc/fugitive-ts.nvim.txt b/doc/fugitive-ts.nvim.txt index 632c8fc..8c092be 100644 --- a/doc/fugitive-ts.nvim.txt +++ b/doc/fugitive-ts.nvim.txt @@ -65,12 +65,10 @@ CONFIGURATION *fugitive-ts-config* Skip treesitter highlighting for hunks larger than this many lines. Prevents lag on massive diffs. - {conceal_prefixes} (boolean, default: true) - Hide diff prefixes (`+`/`-`/` `) using virtual - text overlay. Makes code appear without the - leading diff character. When `highlights.background` - is also enabled, the overlay inherits the line's - background color. + {hide_prefix} (boolean, default: true) + Hide diff prefixes (`+`/`-`/` `) using conceal. + Makes code appear flush left without the leading + diff character. Sets `conceallevel=2` on attach. {highlights} (table, default: see below) Controls which highlight features are enabled. @@ -133,7 +131,7 @@ IMPLEMENTATION *fugitive-ts-implementation* - Background extmarks (`FugitiveTsAdd`/`FugitiveTsDelete`) at priority 198 - `Normal` extmarks at priority 199 clear underlying diff foreground - Treesitter highlights are applied as extmarks at priority 200 - - Virtual text overlays hide diff prefixes when `conceal_prefixes` is enabled + - Conceal extmarks hide diff prefixes when `hide_prefix` is enabled 4. Re-highlighting occurs on `TextChanged` (debounced) and `Syntax` events ============================================================================== diff --git a/lua/fugitive-ts/highlight.lua b/lua/fugitive-ts/highlight.lua index 431ccc7..e4a0b21 100644 --- a/lua/fugitive-ts/highlight.lua +++ b/lua/fugitive-ts/highlight.lua @@ -66,7 +66,7 @@ end ---@class fugitive-ts.HunkOpts ---@field max_lines integer ----@field conceal_prefixes boolean +---@field hide_prefix boolean ---@field highlights fugitive-ts.Highlights ---@param bufnr integer @@ -142,11 +142,10 @@ function M.highlight_hunk(bufnr, ns, hunk, opts) local line_hl = is_diff_line and (prefix == '+' and 'FugitiveTsAdd' or 'FugitiveTsDelete') or nil - if opts.conceal_prefixes then - local virt_hl = (opts.highlights.background and line_hl) or nil + if opts.hide_prefix then pcall(vim.api.nvim_buf_set_extmark, bufnr, ns, buf_line, 0, { - virt_text = { { ' ', virt_hl } }, - virt_text_pos = 'overlay', + end_col = 1, + conceal = '', }) end diff --git a/lua/fugitive-ts/init.lua b/lua/fugitive-ts/init.lua index 33f1809..2b89ca9 100644 --- a/lua/fugitive-ts/init.lua +++ b/lua/fugitive-ts/init.lua @@ -11,7 +11,7 @@ ---@field disabled_languages string[] ---@field debounce_ms integer ---@field max_lines_per_hunk integer ----@field conceal_prefixes boolean +---@field hide_prefix boolean ---@field highlights fugitive-ts.Highlights ---@class fugitive-ts @@ -33,7 +33,7 @@ local default_config = { disabled_languages = {}, debounce_ms = 50, max_lines_per_hunk = 500, - conceal_prefixes = true, + hide_prefix = true, highlights = { treesitter = true, background = true, @@ -75,7 +75,7 @@ local function highlight_buffer(bufnr) for _, hunk in ipairs(hunks) do highlight.highlight_hunk(bufnr, ns, hunk, { max_lines = config.max_lines_per_hunk, - conceal_prefixes = config.conceal_prefixes, + hide_prefix = config.hide_prefix, highlights = config.highlights, }) end @@ -122,6 +122,10 @@ function M.attach(bufnr) dbg('attaching to buffer %d', bufnr) + if config.hide_prefix then + vim.api.nvim_set_option_value('conceallevel', 2, { win = 0 }) + end + local debounced = create_debounced_highlight(bufnr) highlight_buffer(bufnr) @@ -164,7 +168,7 @@ function M.setup(opts) disabled_languages = { opts.disabled_languages, 'table', true }, debounce_ms = { opts.debounce_ms, 'number', true }, max_lines_per_hunk = { opts.max_lines_per_hunk, 'number', true }, - conceal_prefixes = { opts.conceal_prefixes, 'boolean', true }, + hide_prefix = { opts.hide_prefix, 'boolean', true }, highlights = { opts.highlights, 'table', true }, }) diff --git a/spec/highlight_spec.lua b/spec/highlight_spec.lua index 45753c5..7a486ed 100644 --- a/spec/highlight_spec.lua +++ b/spec/highlight_spec.lua @@ -32,7 +32,7 @@ describe('highlight', function() local function default_opts(overrides) local opts = { max_lines = 500, - conceal_prefixes = false, + hide_prefix = false, highlights = { treesitter = true, background = false, @@ -241,7 +241,7 @@ describe('highlight', function() delete_buffer(bufnr) end) - it('applies overlay extmarks when conceal_prefixes enabled', function() + it('applies conceal extmarks when hide_prefix enabled', function() local bufnr = create_buffer({ '@@ -1,1 +1,2 @@', ' local x = 1', @@ -255,20 +255,20 @@ describe('highlight', function() lines = { ' local x = 1', '+local y = 2' }, } - highlight.highlight_hunk(bufnr, ns, hunk, default_opts({ conceal_prefixes = true })) + highlight.highlight_hunk(bufnr, ns, hunk, default_opts({ hide_prefix = true })) local extmarks = get_extmarks(bufnr) - local overlay_count = 0 + local conceal_count = 0 for _, mark in ipairs(extmarks) do - if mark[4] and mark[4].virt_text_pos == 'overlay' then - overlay_count = overlay_count + 1 + if mark[4] and mark[4].conceal == '' then + conceal_count = conceal_count + 1 end end - assert.are.equal(2, overlay_count) + assert.are.equal(2, conceal_count) delete_buffer(bufnr) end) - it('does not apply overlay extmarks when conceal_prefixes disabled', function() + it('does not apply conceal extmarks when hide_prefix disabled', function() local bufnr = create_buffer({ '@@ -1,1 +1,2 @@', ' local x = 1', @@ -282,16 +282,16 @@ describe('highlight', function() lines = { ' local x = 1', '+local y = 2' }, } - highlight.highlight_hunk(bufnr, ns, hunk, default_opts({ conceal_prefixes = false })) + highlight.highlight_hunk(bufnr, ns, hunk, default_opts({ hide_prefix = false })) local extmarks = get_extmarks(bufnr) - local overlay_count = 0 + local conceal_count = 0 for _, mark in ipairs(extmarks) do - if mark[4] and mark[4].virt_text_pos == 'overlay' then - overlay_count = overlay_count + 1 + if mark[4] and mark[4].conceal == '' then + conceal_count = conceal_count + 1 end end - assert.are.equal(0, overlay_count) + assert.are.equal(0, conceal_count) delete_buffer(bufnr) end) diff --git a/spec/init_spec.lua b/spec/init_spec.lua index d7a985d..ce5b64e 100644 --- a/spec/init_spec.lua +++ b/spec/init_spec.lua @@ -24,7 +24,7 @@ describe('fugitive-ts', function() disabled_languages = { 'markdown' }, debounce_ms = 100, max_lines_per_hunk = 1000, - conceal_prefixes = false, + hide_prefix = false, highlights = { treesitter = true, background = true, From 6a64a380b0ef188e7e953935493e0bf2a7e7f543 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Mon, 2 Feb 2026 13:26:19 -0500 Subject: [PATCH 2/6] conceal back to level 1 --- doc/fugitive-ts.nvim.txt | 2 +- lua/fugitive-ts/init.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/fugitive-ts.nvim.txt b/doc/fugitive-ts.nvim.txt index 8c092be..5ba6410 100644 --- a/doc/fugitive-ts.nvim.txt +++ b/doc/fugitive-ts.nvim.txt @@ -68,7 +68,7 @@ CONFIGURATION *fugitive-ts-config* {hide_prefix} (boolean, default: true) Hide diff prefixes (`+`/`-`/` `) using conceal. Makes code appear flush left without the leading - diff character. Sets `conceallevel=2` on attach. + diff character. Sets `conceallevel=1` on attach. {highlights} (table, default: see below) Controls which highlight features are enabled. diff --git a/lua/fugitive-ts/init.lua b/lua/fugitive-ts/init.lua index 2b89ca9..338a62b 100644 --- a/lua/fugitive-ts/init.lua +++ b/lua/fugitive-ts/init.lua @@ -123,7 +123,7 @@ function M.attach(bufnr) dbg('attaching to buffer %d', bufnr) if config.hide_prefix then - vim.api.nvim_set_option_value('conceallevel', 2, { win = 0 }) + vim.api.nvim_set_option_value('conceallevel', 1, { win = 0 }) end local debounced = create_debounced_highlight(bufnr) From dabf2e2cc931d3fb6ff10b178b6578be94ed6d56 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Mon, 2 Feb 2026 13:53:43 -0500 Subject: [PATCH 3/6] feat: highlight improvemnets --- doc/fugitive-ts.nvim.txt | 10 +++--- lua/fugitive-ts/highlight.lua | 9 ++++-- lua/fugitive-ts/init.lua | 57 ++++++++++++++++++++++++++++++----- spec/highlight_spec.lua | 20 ++++++------ 4 files changed, 71 insertions(+), 25 deletions(-) diff --git a/doc/fugitive-ts.nvim.txt b/doc/fugitive-ts.nvim.txt index 5ba6410..d7a56fb 100644 --- a/doc/fugitive-ts.nvim.txt +++ b/doc/fugitive-ts.nvim.txt @@ -56,7 +56,7 @@ CONFIGURATION *fugitive-ts-config* Example: >lua disabled_languages = { 'markdown', 'text' } < - {debounce_ms} (integer, default: 50) + {debounce_ms} (integer, default: 0) Debounce delay in milliseconds for re-highlighting after buffer changes. Lower values feel snappier but use more CPU. @@ -66,9 +66,11 @@ CONFIGURATION *fugitive-ts-config* this many lines. Prevents lag on massive diffs. {hide_prefix} (boolean, default: true) - Hide diff prefixes (`+`/`-`/` `) using conceal. - Makes code appear flush left without the leading - diff character. Sets `conceallevel=1` on attach. + Hide diff prefixes (`+`/`-`/` `) using virtual + text overlay. Makes code appear without the + leading diff character. When `highlights.background` + is also enabled, the overlay inherits the line's + background color. {highlights} (table, default: see below) Controls which highlight features are enabled. diff --git a/lua/fugitive-ts/highlight.lua b/lua/fugitive-ts/highlight.lua index e4a0b21..3a16799 100644 --- a/lua/fugitive-ts/highlight.lua +++ b/lua/fugitive-ts/highlight.lua @@ -141,11 +141,14 @@ function M.highlight_hunk(bufnr, ns, hunk, opts) local is_diff_line = prefix == '+' or prefix == '-' local line_hl = is_diff_line and (prefix == '+' and 'FugitiveTsAdd' or 'FugitiveTsDelete') or nil + local number_hl = is_diff_line and (prefix == '+' and 'FugitiveTsAddNr' or 'FugitiveTsDeleteNr') + or nil if opts.hide_prefix then + local virt_hl = (opts.highlights.background and line_hl) or nil pcall(vim.api.nvim_buf_set_extmark, bufnr, ns, buf_line, 0, { - end_col = 1, - conceal = '', + virt_text = { { ' ', virt_hl } }, + virt_text_pos = 'overlay', }) end @@ -155,7 +158,7 @@ function M.highlight_hunk(bufnr, ns, hunk, opts) priority = 198, } if opts.highlights.gutter then - extmark_opts.number_hl_group = line_hl + extmark_opts.number_hl_group = number_hl end pcall(vim.api.nvim_buf_set_extmark, bufnr, ns, buf_line, 0, extmark_opts) end diff --git a/lua/fugitive-ts/init.lua b/lua/fugitive-ts/init.lua index 338a62b..028275b 100644 --- a/lua/fugitive-ts/init.lua +++ b/lua/fugitive-ts/init.lua @@ -25,15 +25,45 @@ local parser = require('fugitive-ts.parser') local ns = vim.api.nvim_create_namespace('fugitive_ts') +---@param hex integer +---@param bg_hex integer +---@param alpha number +---@return integer +local function blend_color(hex, bg_hex, alpha) + local r = bit.band(bit.rshift(hex, 16), 0xFF) + local g = bit.band(bit.rshift(hex, 8), 0xFF) + local b = bit.band(hex, 0xFF) + + local bg_r = bit.band(bit.rshift(bg_hex, 16), 0xFF) + local bg_g = bit.band(bit.rshift(bg_hex, 8), 0xFF) + local bg_b = bit.band(bg_hex, 0xFF) + + local blend_r = math.floor(r * alpha + bg_r * (1 - alpha)) + local blend_g = math.floor(g * alpha + bg_g * (1 - alpha)) + local blend_b = math.floor(b * alpha + bg_b * (1 - alpha)) + + return bit.bor(bit.lshift(blend_r, 16), bit.lshift(blend_g, 8), blend_b) +end + +---@param name string +---@return vim.api.keyset.hl_info +local function resolve_hl(name) + local hl = vim.api.nvim_get_hl(0, { name = name }) + while hl.link do + hl = vim.api.nvim_get_hl(0, { name = hl.link }) + end + return hl +end + ---@type fugitive-ts.Config local default_config = { enabled = true, debug = false, languages = {}, disabled_languages = {}, - debounce_ms = 50, + debounce_ms = 0, max_lines_per_hunk = 500, - hide_prefix = true, + hide_prefix = false, highlights = { treesitter = true, background = true, @@ -122,10 +152,6 @@ function M.attach(bufnr) dbg('attaching to buffer %d', bufnr) - if config.hide_prefix then - vim.api.nvim_set_option_value('conceallevel', 1, { win = 0 }) - end - local debounced = create_debounced_highlight(bufnr) highlight_buffer(bufnr) @@ -185,10 +211,25 @@ function M.setup(opts) parser.set_debug(config.debug) highlight.set_debug(config.debug) + local normal = vim.api.nvim_get_hl(0, { name = 'Normal' }) local diff_add = vim.api.nvim_get_hl(0, { name = 'DiffAdd' }) local diff_delete = vim.api.nvim_get_hl(0, { name = 'DiffDelete' }) - vim.api.nvim_set_hl(0, 'FugitiveTsAdd', { bg = diff_add.bg }) - vim.api.nvim_set_hl(0, 'FugitiveTsDelete', { bg = diff_delete.bg }) + local diff_added = resolve_hl('diffAdded') + local diff_removed = resolve_hl('diffRemoved') + + local bg = normal.bg or 0x1e1e2e + local add_bg = diff_add.bg or 0x2e4a3a + local del_bg = diff_delete.bg or 0x4a2e3a + local add_fg = diff_added.fg or diff_add.fg or 0x80c080 + local del_fg = diff_removed.fg or diff_delete.fg or 0xc08080 + + local blended_add = blend_color(add_bg, bg, 0.4) + local blended_del = blend_color(del_bg, bg, 0.4) + + vim.api.nvim_set_hl(0, 'FugitiveTsAdd', { bg = blended_add }) + vim.api.nvim_set_hl(0, 'FugitiveTsDelete', { bg = blended_del }) + vim.api.nvim_set_hl(0, 'FugitiveTsAddNr', { fg = add_fg, bg = blended_add }) + vim.api.nvim_set_hl(0, 'FugitiveTsDeleteNr', { fg = del_fg, bg = blended_del }) end return M diff --git a/spec/highlight_spec.lua b/spec/highlight_spec.lua index 7a486ed..1982d43 100644 --- a/spec/highlight_spec.lua +++ b/spec/highlight_spec.lua @@ -241,7 +241,7 @@ describe('highlight', function() delete_buffer(bufnr) end) - it('applies conceal extmarks when hide_prefix enabled', function() + it('applies overlay extmarks when hide_prefix enabled', function() local bufnr = create_buffer({ '@@ -1,1 +1,2 @@', ' local x = 1', @@ -258,17 +258,17 @@ describe('highlight', function() highlight.highlight_hunk(bufnr, ns, hunk, default_opts({ hide_prefix = true })) local extmarks = get_extmarks(bufnr) - local conceal_count = 0 + local overlay_count = 0 for _, mark in ipairs(extmarks) do - if mark[4] and mark[4].conceal == '' then - conceal_count = conceal_count + 1 + if mark[4] and mark[4].virt_text_pos == 'overlay' then + overlay_count = overlay_count + 1 end end - assert.are.equal(2, conceal_count) + assert.are.equal(2, overlay_count) delete_buffer(bufnr) end) - it('does not apply conceal extmarks when hide_prefix disabled', function() + it('does not apply overlay extmarks when hide_prefix disabled', function() local bufnr = create_buffer({ '@@ -1,1 +1,2 @@', ' local x = 1', @@ -285,13 +285,13 @@ describe('highlight', function() highlight.highlight_hunk(bufnr, ns, hunk, default_opts({ hide_prefix = false })) local extmarks = get_extmarks(bufnr) - local conceal_count = 0 + local overlay_count = 0 for _, mark in ipairs(extmarks) do - if mark[4] and mark[4].conceal == '' then - conceal_count = conceal_count + 1 + if mark[4] and mark[4].virt_text_pos == 'overlay' then + overlay_count = overlay_count + 1 end end - assert.are.equal(0, conceal_count) + assert.are.equal(0, overlay_count) delete_buffer(bufnr) end) From e25fb0f297f45491d0853dfe12f8ff32cbbad7ab Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Mon, 2 Feb 2026 14:04:24 -0500 Subject: [PATCH 4/6] fix(ci): typing --- lua/fugitive-ts/highlight.lua | 86 +++++++++++++++++------------------ lua/fugitive-ts/init.lua | 6 ++- 2 files changed, 48 insertions(+), 44 deletions(-) diff --git a/lua/fugitive-ts/highlight.lua b/lua/fugitive-ts/highlight.lua index 3a16799..755c983 100644 --- a/lua/fugitive-ts/highlight.lua +++ b/lua/fugitive-ts/highlight.lua @@ -90,49 +90,6 @@ function M.highlight_hunk(bufnr, ns, hunk, opts) return end - ---@type string[] - local code_lines = {} - for _, line in ipairs(hunk.lines) do - table.insert(code_lines, line:sub(2)) - end - - local code = table.concat(code_lines, '\n') - if code == '' then - return - end - - local ok, parser_obj = pcall(vim.treesitter.get_string_parser, code, lang) - if not ok or not parser_obj then - dbg('failed to create parser for lang: %s', lang) - return - end - - local trees = parser_obj:parse() - if not trees or #trees == 0 then - dbg('parse returned no trees for lang: %s', lang) - return - end - - local query = vim.treesitter.query.get(lang, 'highlights') - if not query then - dbg('no highlights query for lang: %s', lang) - return - end - - if hunk.header_context and hunk.header_context_col then - local header_line = hunk.start_line - 1 - pcall(vim.api.nvim_buf_set_extmark, bufnr, ns, header_line, hunk.header_context_col, { - end_col = hunk.header_context_col + #hunk.header_context, - hl_group = 'Normal', - priority = 199, - }) - local header_extmarks = - highlight_text(bufnr, ns, hunk, hunk.header_context_col, hunk.header_context, lang) - if header_extmarks > 0 then - dbg('header %s:%d applied %d extmarks', hunk.filename, hunk.start_line, header_extmarks) - end - end - for i, line in ipairs(hunk.lines) do local buf_line = hunk.start_line + i - 1 local line_len = #line @@ -176,6 +133,49 @@ function M.highlight_hunk(bufnr, ns, hunk, opts) return end + ---@type string[] + local code_lines = {} + for _, line in ipairs(hunk.lines) do + table.insert(code_lines, line:sub(2)) + end + + local code = table.concat(code_lines, '\n') + if code == '' then + return + end + + local ok, parser_obj = pcall(vim.treesitter.get_string_parser, code, lang) + if not ok or not parser_obj then + dbg('failed to create parser for lang: %s', lang) + return + end + + local trees = parser_obj:parse() + if not trees or #trees == 0 then + dbg('parse returned no trees for lang: %s', lang) + return + end + + local query = vim.treesitter.query.get(lang, 'highlights') + if not query then + dbg('no highlights query for lang: %s', lang) + return + end + + if hunk.header_context and hunk.header_context_col then + local header_line = hunk.start_line - 1 + pcall(vim.api.nvim_buf_set_extmark, bufnr, ns, header_line, hunk.header_context_col, { + end_col = hunk.header_context_col + #hunk.header_context, + hl_group = 'Normal', + priority = 199, + }) + local header_extmarks = + highlight_text(bufnr, ns, hunk, hunk.header_context_col, hunk.header_context, lang) + if header_extmarks > 0 then + dbg('header %s:%d applied %d extmarks', hunk.filename, hunk.start_line, header_extmarks) + end + end + local extmark_count = 0 for id, node, _ in query:iter_captures(trees[1]:root(), code) do local capture_name = '@' .. query.captures[id] diff --git a/lua/fugitive-ts/init.lua b/lua/fugitive-ts/init.lua index 028275b..e57d817 100644 --- a/lua/fugitive-ts/init.lua +++ b/lua/fugitive-ts/init.lua @@ -25,6 +25,8 @@ local parser = require('fugitive-ts.parser') local ns = vim.api.nvim_create_namespace('fugitive_ts') +---@diagnostic disable: undefined-global + ---@param hex integer ---@param bg_hex integer ---@param alpha number @@ -45,8 +47,10 @@ local function blend_color(hex, bg_hex, alpha) return bit.bor(bit.lshift(blend_r, 16), bit.lshift(blend_g, 8), blend_b) end +---@diagnostic enable: undefined-global + ---@param name string ----@return vim.api.keyset.hl_info +---@return table local function resolve_hl(name) local hl = vim.api.nvim_get_hl(0, { name = name }) while hl.link do From bbc120b5de54d33f29b8d94222c5c7b2b0727e5b Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Mon, 2 Feb 2026 14:06:58 -0500 Subject: [PATCH 5/6] cleanup --- lua/fugitive-ts/init.lua | 4 ---- vim.toml | 3 +++ 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lua/fugitive-ts/init.lua b/lua/fugitive-ts/init.lua index e57d817..6abff74 100644 --- a/lua/fugitive-ts/init.lua +++ b/lua/fugitive-ts/init.lua @@ -25,8 +25,6 @@ local parser = require('fugitive-ts.parser') local ns = vim.api.nvim_create_namespace('fugitive_ts') ----@diagnostic disable: undefined-global - ---@param hex integer ---@param bg_hex integer ---@param alpha number @@ -47,8 +45,6 @@ local function blend_color(hex, bg_hex, alpha) return bit.bor(bit.lshift(blend_r, 16), bit.lshift(blend_g, 8), blend_b) end ----@diagnostic enable: undefined-global - ---@param name string ---@return table local function resolve_hl(name) diff --git a/vim.toml b/vim.toml index 8bf26ea..3a84ac2 100644 --- a/vim.toml +++ b/vim.toml @@ -8,6 +8,9 @@ any = true [jit] any = true +[bit] +any = true + [assert] any = true From 71938e6cfe09fc14a308648ce4a489ef5c4f9e7f Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Mon, 2 Feb 2026 14:10:15 -0500 Subject: [PATCH 6/6] fix(ci): diagnostics --- lua/fugitive-ts/init.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/fugitive-ts/init.lua b/lua/fugitive-ts/init.lua index 6abff74..b71ae24 100644 --- a/lua/fugitive-ts/init.lua +++ b/lua/fugitive-ts/init.lua @@ -30,6 +30,7 @@ local ns = vim.api.nvim_create_namespace('fugitive_ts') ---@param alpha number ---@return integer local function blend_color(hex, bg_hex, alpha) + ---@diagnostic disable: undefined-global local r = bit.band(bit.rshift(hex, 16), 0xFF) local g = bit.band(bit.rshift(hex, 8), 0xFF) local b = bit.band(hex, 0xFF) @@ -43,6 +44,7 @@ local function blend_color(hex, bg_hex, alpha) local blend_b = math.floor(b * alpha + bg_b * (1 - alpha)) return bit.bor(bit.lshift(blend_r, 16), bit.lshift(blend_g, 8), blend_b) + ---@diagnostic enable: undefined-global end ---@param name string