From b4d85dc99ac5203a2733636739aea8e8e62529b7 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Wed, 18 Feb 2026 13:31:58 -0500 Subject: [PATCH 1/2] remove config deprecation in v0.3.0 migration --- doc/diffs.nvim.txt | 6 +---- lua/diffs/init.lua | 57 +++------------------------------------------- spec/init_spec.lua | 24 ------------------- 3 files changed, 4 insertions(+), 83 deletions(-) diff --git a/doc/diffs.nvim.txt b/doc/diffs.nvim.txt index 1b816f1..dd87d46 100644 --- a/doc/diffs.nvim.txt +++ b/doc/diffs.nvim.txt @@ -36,7 +36,7 @@ etc.) works without vim-fugitive. ============================================================================== SETUP *diffs-setup* -Using lazy.nvim: >lua +Install with lazy.nvim: >lua { 'barrettruth/diffs.nvim', dependencies = { 'tpope/vim-fugitive' }, @@ -621,10 +621,6 @@ line visuals. The overrides are reapplied on `ColorScheme` since Neogit re-defines its groups then. When `neogit = false`, no highlight overrides are applied. -Deprecated: ~ -The `filetypes` config key still works but is deprecated and will be -removed in 0.3.0. Use `fugitive`, `neogit`, and `extra_filetypes` instead. - ============================================================================== API *diffs-api* diff --git a/lua/diffs/init.lua b/lua/diffs/init.lua index a293cf9..2423596 100644 --- a/lua/diffs/init.lua +++ b/lua/diffs/init.lua @@ -58,7 +58,6 @@ ---@class diffs.Config ---@field debug boolean|string ---@field hide_prefix boolean ----@field filetypes? string[] @deprecated use fugitive, neogit, extra_filetypes ---@field extra_filetypes string[] ---@field highlights diffs.Highlights ---@field fugitive diffs.FugitiveConfig|false @@ -193,16 +192,13 @@ end ---@param opts table ---@return string[] function M.compute_filetypes(opts) - if opts.filetypes then - return opts.filetypes - end local fts = { 'git', 'gitcommit' } local fug = opts.fugitive - if fug == true or (type(fug) == 'table' and fug.enabled ~= false) then + if fug == true or type(fug) == 'table' then table.insert(fts, 'fugitive') end local neo = opts.neogit - if neo == true or (type(neo) == 'table' and neo.enabled ~= false) then + if neo == true or type(neo) == 'table' then table.insert(fts, 'NeogitStatus') table.insert(fts, 'NeogitCommitView') table.insert(fts, 'NeogitDiffView') @@ -450,62 +446,15 @@ local function init() local opts = vim.g.diffs or {} - if opts.filetypes then - vim.deprecate( - 'vim.g.diffs.filetypes', - 'fugitive, neogit, and extra_filetypes', - '0.3.0', - 'diffs.nvim' - ) - end - - if not opts.filetypes and opts.fugitive == nil and opts.neogit == nil then - local has_diff_ft = false - if type(opts.extra_filetypes) == 'table' then - for _, ft in ipairs(opts.extra_filetypes) do - if ft == 'diff' then - has_diff_ft = true - break - end - end - end - if not has_diff_ft then - vim.notify( - '[diffs.nvim] fugitive, neogit, and diff filetypes are now opt-in.\n' - .. 'Add the integrations you use to your config:\n\n' - .. ' vim.g.diffs = {\n' - .. ' fugitive = true,\n' - .. ' neogit = true,\n' - .. " extra_filetypes = { 'diff' },\n" - .. ' }\n\n' - .. 'This warning will be removed in 0.3.0.', - vim.log.levels.WARN - ) - end - end - local fugitive_defaults = { horizontal = 'du', vertical = 'dU' } if opts.fugitive == true then opts.fugitive = vim.deepcopy(fugitive_defaults) elseif type(opts.fugitive) == 'table' then - if opts.fugitive.enabled == false then - opts.fugitive = false - else - ---@diagnostic disable-next-line: inject-field - opts.fugitive.enabled = nil - opts.fugitive = vim.tbl_extend('keep', opts.fugitive, fugitive_defaults) - end + opts.fugitive = vim.tbl_extend('keep', opts.fugitive, fugitive_defaults) end if opts.neogit == true then opts.neogit = {} - elseif type(opts.neogit) == 'table' then - if opts.neogit.enabled == false then - opts.neogit = false - else - ---@diagnostic disable-next-line: inject-field - opts.neogit.enabled = nil - end end vim.validate({ diff --git a/spec/init_spec.lua b/spec/init_spec.lua index 33b93fc..e94efea 100644 --- a/spec/init_spec.lua +++ b/spec/init_spec.lua @@ -391,30 +391,6 @@ describe('diffs', function() assert.is_true(vim.tbl_contains(fts, 'diff')) end) - it('returns custom filetypes when filetypes key is set', function() - local fts = compute({ filetypes = { 'custom' } }) - assert.are.same({ 'custom' }, fts) - end) - - it('backward compat: includes fugitive when enabled = true in table', function() - local fts = compute({ fugitive = { enabled = true } }) - assert.is_true(vim.tbl_contains(fts, 'fugitive')) - end) - - it('backward compat: excludes fugitive when enabled = false in table', function() - local fts = compute({ fugitive = { enabled = false } }) - assert.is_false(vim.tbl_contains(fts, 'fugitive')) - end) - - it('backward compat: includes neogit when enabled = true in table', function() - local fts = compute({ neogit = { enabled = true } }) - assert.is_true(vim.tbl_contains(fts, 'NeogitStatus')) - end) - - it('backward compat: excludes neogit when enabled = false in table', function() - local fts = compute({ neogit = { enabled = false } }) - assert.is_false(vim.tbl_contains(fts, 'NeogitStatus')) - end) end) describe('diff mode', function() From 9c9e7a5cc40f5bd32aecec8ac6f8267319594b37 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Wed, 18 Feb 2026 13:33:04 -0500 Subject: [PATCH 2/2] fix(ci): stylua --- spec/init_spec.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/spec/init_spec.lua b/spec/init_spec.lua index e94efea..2e1952e 100644 --- a/spec/init_spec.lua +++ b/spec/init_spec.lua @@ -390,7 +390,6 @@ describe('diffs', function() assert.is_true(vim.tbl_contains(fts, 'NeogitStatus')) assert.is_true(vim.tbl_contains(fts, 'diff')) end) - end) describe('diff mode', function()