From f71b0f54c5c03c6bb20a5bee47b08b2dc52b5ed9 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Tue, 3 Feb 2026 02:50:25 -0500 Subject: [PATCH 1/3] fix: remove useless `enabled` flag --- README.md | 2 +- doc/diffs.nvim.txt | 3 --- lua/diffs/init.lua | 11 ----------- 3 files changed, 1 insertion(+), 15 deletions(-) diff --git a/README.md b/README.md index 49eaa5a..6c222a4 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ luarocks install diffs.nvim The buffer is then re-painted after `debounce_ms` milliseconds, causing an unavoidable visual "flash" even when `debounce_ms = 0`. -## Acknowledgements +# Acknowledgements - [vim-fugitive](https://github.com/tpope/vim-fugitive) - [codediff.nvim](https://github.com/esmuellert/codediff.nvim) diff --git a/doc/diffs.nvim.txt b/doc/diffs.nvim.txt index 1916683..6561627 100644 --- a/doc/diffs.nvim.txt +++ b/doc/diffs.nvim.txt @@ -48,9 +48,6 @@ CONFIGURATION *diffs-config* *diffs.Config* Fields: ~ - {enabled} (boolean, default: true) - Enable or disable highlighting globally. - {debug} (boolean, default: false) Enable debug logging to |:messages| with `[diffs]` prefix. diff --git a/lua/diffs/init.lua b/lua/diffs/init.lua index b51d338..c47beda 100644 --- a/lua/diffs/init.lua +++ b/lua/diffs/init.lua @@ -11,7 +11,6 @@ ---@field max_lines integer ---@class diffs.Config ----@field enabled boolean ---@field debug boolean ---@field debounce_ms integer ---@field hide_prefix boolean @@ -65,7 +64,6 @@ end ---@type diffs.Config local default_config = { - enabled = true, debug = false, debounce_ms = 0, hide_prefix = false, @@ -102,10 +100,6 @@ local dbg = log.dbg ---@param bufnr integer local function highlight_buffer(bufnr) - if not config.enabled then - return - end - if not vim.api.nvim_buf_is_valid(bufnr) then return end @@ -242,10 +236,6 @@ local DIFF_WINHIGHLIGHT = table.concat({ }, ',') function M.attach_diff() - if not config.enabled then - return - end - local tabpage = vim.api.nvim_get_current_tabpage() local wins = vim.api.nvim_tabpage_list_wins(tabpage) @@ -282,7 +272,6 @@ function M.setup(opts) opts = opts or {} vim.validate({ - enabled = { opts.enabled, 'boolean', true }, debug = { opts.debug, 'boolean', true }, debounce_ms = { opts.debounce_ms, 'number', true }, hide_prefix = { opts.hide_prefix, 'boolean', true }, From 92cddd75c3bd17ad5706a192698e6ee841204931 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Tue, 3 Feb 2026 02:51:48 -0500 Subject: [PATCH 2/3] fix(test): remove old test --- spec/init_spec.lua | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/spec/init_spec.lua b/spec/init_spec.lua index 84fbc99..8311377 100644 --- a/spec/init_spec.lua +++ b/spec/init_spec.lua @@ -204,17 +204,6 @@ describe('diffs', function() close_window(win) end) - it('does nothing when enabled=false', function() - diffs.setup({ enabled = false }) - local win, _ = create_diff_window() - diffs.attach_diff() - - local whl = vim.api.nvim_get_option_value('winhighlight', { win = win }) - assert.are.equal('', whl) - - close_window(win) - end) - it('is idempotent', function() local win, _ = create_diff_window() assert.has_no.errors(function() From fd270b8215adfc8197799457ade605da389c054e Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Tue, 3 Feb 2026 02:53:25 -0500 Subject: [PATCH 3/3] fix(test): remove other uesless test --- spec/init_spec.lua | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/spec/init_spec.lua b/spec/init_spec.lua index 8311377..19da8f7 100644 --- a/spec/init_spec.lua +++ b/spec/init_spec.lua @@ -131,26 +131,6 @@ describe('diffs', function() end) end) - describe('config options', function() - it('enabled=false prevents highlighting', function() - diffs.setup({ enabled = false }) - local bufnr = vim.api.nvim_create_buf(false, true) - vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, { - 'M test.lua', - '@@ -1,1 +1,2 @@', - ' local x = 1', - '+local y = 2', - }) - diffs.attach(bufnr) - - local ns = vim.api.nvim_create_namespace('diffs') - local extmarks = vim.api.nvim_buf_get_extmarks(bufnr, ns, 0, -1, {}) - assert.are.equal(0, #extmarks) - - vim.api.nvim_buf_delete(bufnr, { force = true }) - end) - end) - describe('is_fugitive_buffer', function() it('returns true for fugitive:// URLs', function() local bufnr = vim.api.nvim_create_buf(false, true)