Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 25 additions & 26 deletions doc/diffs.nvim.txt
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ Configuration is done via `vim.g.diffs`. Set options before the plugin loads:
Deprecated. See |diffs.nvim-extra-filetypes|.

{highlights} (table, default: see below)
Controls which highlight features are enabled.
Syntax and diff highlighting.
See |diffs.nvim.Highlights| for fields.

{conflict} (boolean|table, default: true)
Expand All @@ -167,27 +167,27 @@ Configuration is done via `vim.g.diffs`. Set options before the plugin loads:
*diffs.nvim.Highlights*
Highlights table fields: ~
{background} (boolean, default: true)
Apply background highlighting to `+`/`-` lines
using `DiffsAdd`/`DiffsDelete` groups (derived
from `DiffAdd`/`DiffDelete` backgrounds).
Highlight added and deleted lines with
`DiffsAdd` and `DiffsDelete` backgrounds.

{blend_alpha} (number, default: 0.6)
Alpha value for diff line background intensity.
Controls how strongly diff lines (adds/deletes)
stand out from the editor background. Must be
between 0 and 1 (inclusive).
Blend diff backgrounds with the editor background.
Use 0 for the editor background or 1 for the
full `DiffAdd` and `DiffDelete` colors.

{warn_max_lines} (boolean, default: true)
Show a `vim.notify()` warning when syntax
highlighting is skipped because a hunk exceeds
{max_lines}. See |diffs.nvim-max-lines|.

{treesitter} (table, default: see below)
Treesitter highlighting limits.
Highlight code with Treesitter when a parser
is available.
See |diffs.nvim.TreesitterConfig| for fields.

{vim} (boolean|table, default: true)
Vim syntax fallback highlighting options.
Use Vim syntax when no Treesitter parser is
available. Set to false to disable.
See |diffs.nvim.VimConfig| for fields.

{intra} (boolean|table, default: true)
Expand All @@ -201,17 +201,16 @@ Configuration is done via `vim.g.diffs`. Set options before the plugin loads:
*diffs.nvim.TreesitterConfig*
Treesitter config fields: ~
{max_lines} (integer, default: 500)
Skip treesitter highlighting for hunks with more
highlighted lines (`+`/`-`) than this threshold.
Context lines are not counted. Prevents lag on
massive diffs.
Skip Treesitter highlighting for hunks with more
than this many added and deleted lines.
Context lines do not count toward the limit.

*diffs.nvim.VimConfig*
Vim config fields: ~
{max_lines} (integer, default: 200)
Skip vim syntax highlighting for hunks with more
highlighted lines (`+`/`-`) than this threshold.
Context lines are not counted.
Skip Vim syntax highlighting for hunks with more
than this many added and deleted lines.
Context lines do not count toward the limit.

*diffs.nvim.IntraConfig*
Intra config fields: ~
Expand All @@ -226,17 +225,17 @@ Configuration is done via `vim.g.diffs`. Set options before the plugin loads:
to use Neovim's diff.

{max_lines} (integer, default: 500)
Skip character-level highlighting for hunks with
more highlighted lines (`+`/`-`) than this
threshold. Context lines are not counted.
Skip intra-line highlighting for hunks with more
than this many added and deleted lines.
Context lines do not count toward the limit.

Note: Header context (e.g., `@@ -10,3 +10,4 @@ func()`) is always
highlighted with treesitter when a parser is available.
Treesitter also highlights code in hunk headers, such as `func()` in
`@@ -10,3 +10,4 @@ func()`.

Language detection uses Neovim's built-in `vim.filetype.match()` and
`vim.treesitter.language.get_lang()`. To customize filetype detection
or register treesitter parsers for custom filetypes, use
`vim.filetype.add()` and `vim.treesitter.language.register()`.
diffs.nvim detects the filetype with |vim.filetype.match()| and selects
the parser with |vim.treesitter.language.get_lang()|. Use
|vim.filetype.add()| for custom filetypes and
|vim.treesitter.language.register()| to associate them with a parser.

==============================================================================
MAX LINES *diffs.nvim-max-lines*
Expand Down
27 changes: 0 additions & 27 deletions lua/diffs/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -130,34 +130,7 @@ function M.new(opts)
vim.log.levels.WARN
)
end
if opts.highlights and opts.highlights.context ~= nil then
vim.notify_once(
'[diffs]: highlights.context was removed and is ignored. Remove it from the configuration.',
vim.log.levels.WARN
)
end
local result = vim.tbl_deep_extend('force', DEFAULTS, opts)
for _, key in ipairs({ 'treesitter', 'vim', 'intra' }) do
local value = result.highlights[key]
if type(value) == 'table' and value.enabled ~= nil then
local migration = key == 'treesitter'
and 'The enabled field is ignored. Tree-sitter highlighting is always enabled. Remove enabled.'
or key == 'intra' and 'Remove enabled and use diffopt. See :help diffs.nvim-diffopt.'
or 'Use highlights.vim = false to disable Vim syntax. Otherwise remove enabled.'
vim.notify_once(
'[diffs]: highlights.'
.. key
.. '.enabled is deprecated. Support ends on November 30, 2026. '
.. migration,
vim.log.levels.WARN
)
if key ~= 'treesitter' and value.enabled == false then
result.highlights[key] = false
else
value.enabled = nil
end
end
end
if type(result.conflict) == 'table' and result.conflict.enabled ~= nil then
vim.notify_once(
'[diffs]: conflict.enabled is deprecated. Support ends on November 30, 2026. '
Expand Down
Loading