diff options
Diffstat (limited to 'runtime/doc/lua.txt')
-rw-r--r-- | runtime/doc/lua.txt | 74 |
1 files changed, 73 insertions, 1 deletions
diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index fd1bedd8ef..28667d5bd1 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -616,6 +616,73 @@ regex:match_line({bufnr}, {line_idx}[, {start}, {end}]) *regex:match_line()* indices will be relative {start}. ------------------------------------------------------------------------------ +VIM.DIFF *lua-diff* + +vim.diff({a}, {b}, {opts}) *vim.diff()* + Run diff on strings {a} and {b}. Any indices returned by this + function, either directly or via callback arguments, are + 1-based. + + Examples: > + vim.diff('a\n', 'b\nc\n') + --> + @@ -1 +1,2 @@ + -a + +b + +c + + vim.diff('a\n', 'b\nc\n', {hunk_lines = true}) + --> + { + {1, 1, 1, 2} + } +< + Parameters: ~ + {a} First string to compare + {b} Second string to compare + {opts} Optional parameters: + • `on_hunk` (callback): + Invoked for each hunk in the diff. Return a + negative number to cancel the callback for any + remaining hunks. + Args: + • `start_a` (integer): Start line of hunk in {a}. + • `count_a` (integer): Hunk size in {a}. + • `start_b` (integer): Start line of hunk in {b}. + • `count_b` (integer): Hunk size in {b}. + • `result_type` (string): Form of the returned diff: + • "unified": (default) String in unified format. + • "indices": Array of hunk locations. + Note this option is ignored if `on_hunk` is + used. + • `algorithm` (string): + 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 + • `ctxlen` (integer): Context length + • `interhunkctxlen` (integer): + Inter hunk context length + • `ignore_whitespace` (boolean): + Ignore whitespace + • `ignore_whitespace_change` (boolean): + Ignore whitespace change + • `ignore_whitespace_change_at_eol` (boolean) + Ignore whitespace change at end-of-line. + • `ignore_cr_at_eol` (boolean) + Ignore carriage return at end-of-line + • `ignore_blank_lines` (boolean) + Ignore blank lines + • `indent_heuristic` (boolean): + Use the indent heuristic for the internal + diff library. + + Return: ~ + See {opts.result_type}. nil if {opts.on_hunk} is given. + +------------------------------------------------------------------------------ VIM *lua-builtin* vim.api.{func}({...}) *vim.api* @@ -1110,7 +1177,9 @@ make_dict_accessor({scope}) *vim.make_dict_accessor()* TODO: Documentation notify({msg}, {log_level}, {_opts}) *vim.notify()* - Notification provider without a runtime, writes to :Messages + Notification provider + + Without a runtime, writes to :Messages Parameters: ~ {msg} Content of the notification to show to the @@ -1119,6 +1188,9 @@ notify({msg}, {log_level}, {_opts}) *vim.notify()* {opts} Dictionary with optional options (timeout, etc) + See also: ~ + :help nvim_notify + paste({lines}, {phase}) *vim.paste()* Paste handler, invoked by |nvim_paste()| when a conforming UI (such as the |TUI|) pastes text into the editor. |