|
1 |
| -*builtin.txt* For Vim version 9.1. Last change: 2024 Jan 25 |
| 1 | +*builtin.txt* For Vim version 9.1. Last change: 2024 Feb 01 |
2 | 2 |
|
3 | 3 |
|
4 | 4 | VIM REFERENCE MANUAL by Bram Moolenaar
|
@@ -147,6 +147,8 @@ delete({fname} [, {flags}]) Number delete the file or directory {fname}
|
147 | 147 | deletebufline({buf}, {first} [, {last}])
|
148 | 148 | Number delete lines from buffer {buf}
|
149 | 149 | did_filetype() Number |TRUE| if FileType autocmd event used
|
| 150 | +diff({fromlist}, {tolist} [, {options}]) |
| 151 | + List diff two Lists of strings |
150 | 152 | diff_filler({lnum}) Number diff filler lines about {lnum}
|
151 | 153 | diff_hlID({lnum}, {col}) Number diff highlighting at {lnum}/{col}
|
152 | 154 | digraph_get({chars}) String get the |digraph| of {chars}
|
@@ -2046,6 +2048,67 @@ did_filetype() Returns |TRUE| when autocommands are being executed and the
|
2046 | 2048 | editing another buffer to set 'filetype' and load a syntax
|
2047 | 2049 | file.
|
2048 | 2050 |
|
| 2051 | +diff({fromlist}, {tolist} [, {options}]) *diff()* |
| 2052 | + Returns a String or a List containing the diff between the |
| 2053 | + strings in {fromlist} and {tolist}. Uses the Vim internal |
| 2054 | + diff library to compute the diff. |
| 2055 | + |
| 2056 | + *E106* |
| 2057 | + The optional "output" item in {options} specifies the returned |
| 2058 | + diff format. The following values are supported: |
| 2059 | + indices Return a List of the starting and ending |
| 2060 | + indices and a count of the strings in each |
| 2061 | + diff hunk. |
| 2062 | + unified Return the unified diff output as a String. |
| 2063 | + This is the default. |
| 2064 | + |
| 2065 | + If the "output" item in {options} is "indices", then a List is |
| 2066 | + returned. Each List item contains a Dict with the following |
| 2067 | + items for each diff hunk: |
| 2068 | + from_idx start index in {fromlist} for this diff hunk. |
| 2069 | + from_count number of strings in {fromlist} that are |
| 2070 | + added/removed/modified in this diff hunk. |
| 2071 | + to_idx start index in {tolist} for this diff hunk. |
| 2072 | + to_count number of strings in {tolist} that are |
| 2073 | + added/removed/modified in this diff hunk. |
| 2074 | + |
| 2075 | + The {options} Dict argument also specifies diff options |
| 2076 | + (similar to 'diffopt') and supports the following items: |
| 2077 | + iblank ignore changes where lines are all |
| 2078 | + blank. |
| 2079 | + icase ignore changes in case of text. |
| 2080 | + iwhite ignore changes in amount of white |
| 2081 | + space. |
| 2082 | + iwhiteall ignore all white space changes. |
| 2083 | + iwhiteeol ignore white space changes at end of |
| 2084 | + line. |
| 2085 | + indent-heuristic use the indent heuristic for the |
| 2086 | + internal diff library. |
| 2087 | + algorithm Dict specifying the diff algorithm to |
| 2088 | + use. Supported boolean items are |
| 2089 | + "myers", "minimal", "patience" and |
| 2090 | + "histogram". |
| 2091 | + For more information about these options, refer to 'diffopt'. |
| 2092 | + |
| 2093 | + Returns an empty List or String if {fromlist} and {tolist} are |
| 2094 | + identical. |
| 2095 | + |
| 2096 | + Examples: |
| 2097 | + :echo diff(['abc'], ['xxx']) |
| 2098 | + @@ -1 +1 @@ |
| 2099 | + -abc |
| 2100 | + +xxx |
| 2101 | + |
| 2102 | + :echo diff(['abc'], ['xxx'], {'output': 'indices'}) |
| 2103 | + [{'from_idx': 0, 'from_count': 1, 'to_idx': 0, 'to_count': 1}] |
| 2104 | + :echo diff(readfile('oldfile'), readfile('newfile')) |
| 2105 | + :echo diff(getbufline(5, 1, '$'), getbufline(6, 1, '$')) |
| 2106 | + |
| 2107 | + For more examples, refer to |diff-func-examples| |
| 2108 | + |
| 2109 | + Can also be used as a |method|: > |
| 2110 | + GetFromList->diff(to_list) |
| 2111 | +< |
2049 | 2112 | diff_filler({lnum}) *diff_filler()*
|
2050 | 2113 | Returns the number of filler lines above line {lnum}.
|
2051 | 2114 | These are the lines that were inserted at this point in
|
@@ -4424,14 +4487,16 @@ getwinpos([{timeout}]) *getwinpos()*
|
4424 | 4487 | getwinposx() The result is a Number, which is the X coordinate in pixels of
|
4425 | 4488 | the left hand side of the GUI Vim window. Also works for an
|
4426 | 4489 | xterm (uses a timeout of 100 msec).
|
4427 |
| - The result will be -1 if the information is not available. |
| 4490 | + The result will be -1 if the information is not available |
| 4491 | + (e.g. on the Wayland backend). |
4428 | 4492 | The value can be used with `:winpos`.
|
4429 | 4493 |
|
4430 | 4494 | *getwinposy()*
|
4431 | 4495 | getwinposy() The result is a Number, which is the Y coordinate in pixels of
|
4432 | 4496 | the top of the GUI Vim window. Also works for an xterm (uses
|
4433 | 4497 | a timeout of 100 msec).
|
4434 |
| - The result will be -1 if the information is not available. |
| 4498 | + The result will be -1 if the information is not available |
| 4499 | + (e.g. on the Wayland backend). |
4435 | 4500 | The value can be used with `:winpos`.
|
4436 | 4501 |
|
4437 | 4502 | getwinvar({winnr}, {varname} [, {def}]) *getwinvar()*
|
|
0 commit comments