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 }, diff --git a/spec/init_spec.lua b/spec/init_spec.lua index 84fbc99..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) @@ -204,17 +184,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()