nvim_runtime_lua

vim.text.diff.Opts

Optional parameters:

@inlinedoc

Fields12

Opts.on_hunk : fun(start_a: integer, count_a: integer, start_b: integer, count_b: integer) -> nil | integer | nil
Opts.result_type : "unified" | "indices" | nil

Form of the returned diff:

  • unified: String in unified format.
  • indices: Array of hunk locations.
  • Note: This option is ignored if on_hunk is used. (default: 'unified')

Opts.linematch : nil | boolean | integer

Run linematch on the resulting hunks from xdiff. When integer, only hunks upto this size in lines are run through linematch. Requires result_type = indices, ignored otherwise.

Opts.algorithm : "myers" | "minimal" | "patience" | "histogram" | nil

Diff algorithm to use. Values:

  • myers: the default algorithm
  • minimal: spend extra time to generate the smallest possible diff
  • patience: patience diff algorithm
  • histogram: histogram diff algorithm
  • (default: 'myers')

Opts.ctxlen : nil | integer

Context length

Opts.interhunkctxlen : nil | integer

Inter hunk context length

Opts.ignore_whitespace : nil | boolean

Ignore whitespace

Opts.ignore_whitespace_change : nil | boolean

Ignore whitespace change

Opts.ignore_whitespace_change_at_eol : nil | boolean

Ignore whitespace change at end-of-line.

Opts.ignore_cr_at_eol : nil | boolean

Ignore carriage return at end-of-line

Opts.ignore_blank_lines : nil | boolean

Ignore blank lines

Opts.indent_heuristic : nil | boolean

Use the indent heuristic for the internal diff library.