Lines Matching refs:diff

1 *diff.txt*      For Vim version 8.2.  Last change: 2021 May 24
7 *diff* *vimdiff* *gvimdiff* *diff-mode*
8 This file describes the |+diff| feature: Showing differences between two to
13 1. Starting diff mode |start-vimdiff|
17 5. Diff options |diff-options|
20 1. Starting diff mode *start-vimdiff*
22 The easiest way to start editing in diff mode is with the "vimdiff" command.
40 By default an internal diff library will be used. When 'diffopt' or
41 'diffexpr' has been set an external "diff" command will be used. This only
42 works when such a diff program is available.
58 'diff' on
63 'foldmethod' "diff"
69 However, 'foldmethod' and 'wrap' won't be set from a modeline when 'diff' is
76 immediately taken into account, especially when using an external diff command.
79 diff mode. You could use a construct like this: >
81 if &diff
82 setup for diff mode
84 setup for non-diff mode
87 While already in Vim you can start diff mode in three ways.
96 :difft[his] Make the current window part of the diff windows. This sets
100 Use the current buffer, patch it with the diff found in
105 Note that {patchfile} should only contain a diff for one file,
116 :vert diffpatch /tmp/diff
121 There can be up to eight buffers with 'diff' set.
124 file for a moment and come back to the same file and be in diff mode again.
127 :diffo[ff] Switch off diff mode for the current window. Resets related
128 options also when 'diff' was not set.
130 :diffo[ff]! Switch off diff mode for the current window and in all windows
131 in the current tab page where 'diff' is set. Resetting
132 related options only happens in a window that has 'diff' set,
133 if the current window does not have 'diff' set then no options
135 Hidden buffers are also removed from the list of diff'ed
139 using `:diffsplit`, `:diffpatch` , `:diffthis`. or starting Vim in diff mode.
143 'diff' off
154 The effect is that the diff windows show the same text, with the differences
168 All the buffers edited in a window where the 'diff' option is set will join in
169 the diff. This is also possible for hidden buffers. They must have been
173 *:DiffOrig* *diff-original-file*
174 Since 'diff' is a window-local option, it's possible to view the same buffer
175 in diff mode in one window and "normal" in another window. It is also
184 A buffer that is unloaded cannot be used for the diff. But it does work for
186 buffer. If you don't want a buffer to remain used for the diff do ":set
189 *:dif* *:diff* *:diffupdate*
190 :dif[fupdate][!] Update the diff highlighting and folds.
260 Otherwise this only works if there is one other buffer in diff
270 buffer in diff mode where 'modifiable' is set this fails.
287 When no [range] is given, the diff at the cursor position or just above it is
292 is on the last line in the buffer and there is no diff above this line, the
312 :diffget Use the other buffer which is in diff mode
315 diff mode (e.g., "file.c.v2")
318 5. Diff options *diff-options*
320 Also see |'diffopt'| and the "diff" item of |'fillchars'|.
322 *diff-slow* *diff_translations*
323 For very long lines, the diff syntax highlighting might be slow, especially
332 set syntax=diff
336 FINDING THE DIFFERENCES *diff-diffexpr*
339 "diff" program to compare two files and find the differences. *E959*
344 diff file1 file2 > outfile
348 The output of "diff" must be a normal "ed" style diff or a unified diff. A
349 context diff will NOT work. For a unified diff no context lines can be used.
350 Using "diff -u" will NOT work, use "diff -U0".
352 This example explains the format that Vim expects for the "ed" style diff: >
367 When 'diffexpr' is not empty, Vim evaluates it to obtain a diff file in the
372 v:fname_out resulting diff file
389 silent execute "!diff -a --binary " . opt . v:fname_in . " " . v:fname_new .
402 Vim will do a test if the diff output looks alright. If it doesn't, you will
404 - The "diff" program cannot be executed.
405 - The "diff" program doesn't produce normal "ed" style diffs (see above).
412 The self-installing Vim for MS-Windows includes a diff program. If you don't
413 have it you might want to download a diff.exe. For example from
417 USING PATCHES *diff-patchexpr*