Home Explore Blog CI



neovim

4th chunk of `runtime/doc/diff.txt`
99c40e7017f46c9c75ffab9b7bf00635968865e41ca46c2f0000000100000fb4
	"iwhite" and "icase" are used here.
				With `inline:` set to "char" or "word", Vim
				uses the internal diff library to perform a
				detailed diff between the changed blocks and
				highlight the exact difference between the
				two.  Will respect any 'diffopt' flag that
				affects internal diff.
				Not used when `inline:` is set to "none".
|hl-DiffTextAdd|  DiffTextAdd	Added text inside a Changed line.  Similar to
				DiffText, but used when there is no
				corresponding text in other buffers.  Not used
				when `inline:` is set to "simple" or "none".
|hl-DiffDelete|	DiffDelete	Deleted lines.  Also called filler lines,
				because they don't really exist in this
				buffer.

==============================================================================
3. Jumping to diffs					*jumpto-diffs*

Two commands can be used to jump to diffs:
								*[c*
	[c		Jump backwards to the previous start of a change.
			When a count is used, do it that many times.
								*]c*
	]c		Jump forwards to the next start of a change.
			When a count is used, do it that many times.

It is an error if there is no change for the cursor to move to.

==============================================================================
4. Diff copying			*copy-diffs* *E99* *E100* *E101* *E102* *E103*
								*merge*
There are two commands to copy text from one buffer to another.  The result is
that the buffers will be equal within the specified range.

							*:diffg* *:diffget*
:[range]diffg[et] [bufspec]
		Modify the current buffer to undo difference with another
		buffer.  If [bufspec] is given, that buffer is used.  If
		[bufspec] refers to the current buffer then nothing happens.
		Otherwise this only works if there is one other buffer in diff
		mode.
		See below for [range].

						*:diffpu* *:diffput* *E793*
:[range]diffpu[t] [bufspec]
		Modify another buffer to undo difference with the current
		buffer.  Just like ":diffget" but the other buffer is modified
		instead of the current one.
		When [bufspec] is omitted and there is more than one other
		buffer in diff mode where 'modifiable' is set this fails.
		See below for [range].

							*do*
[count]do	Same as ":diffget" without range.  The "o" stands for "obtain"
		("dg" can't be used, it could be the start of "dgg"!). Note:
		this doesn't work in Visual mode.
		If you give a [count], it is used as the [bufspec] argument
		for ":diffget".

							*dp*
[count]dp	Same as ":diffput" without range.  Note: this doesn't work in
		Visual mode.
		If you give a [count], it is used as the [bufspec] argument
		for ":diffput".


When no [range] is given, the diff at the cursor position or just above it is
affected.  When [range] is used, Vim tries to only put or get the specified
lines.  When there are deleted lines, this may not always be possible.

There can be deleted lines below the last line of the buffer.  When the cursor
is on the last line in the buffer and there is no diff above this line, the
":diffget" and "do" commands will obtain lines from the other buffer.

To be able to get those lines from another buffer in a [range] it's allowed to
use the last line number plus one.  This command gets all diffs from the other
buffer: >

	:1,$+1diffget

Note that deleted lines are displayed, but not counted as text lines.  You
can't move the cursor into them.  To fill the deleted lines with the lines
from another buffer use ":diffget" on the line below them.
								*E787*
When the buffer that is about to be modified is read-only and the autocommand
that is triggered by |FileChangedRO| changes buffers the command will fail.
The autocommand must not change buffers.

The [bufspec] argument above can be a buffer number, a pattern for a buffer
name or a part of a buffer name.  Examples:

	:diffget		Use the other buffer which is in diff mode
	:diffget 3		Use buffer 3
	:diffget v2		Use the buffer which matches "v2" and is in
				diff mode (e.g., "file.c.v2")

==============================================================================

Title: Jumping and Copying Diffs: Commands and Usage
Summary
This section describes the commands for jumping between diffs using `[c` and `]c`. It details how to copy text between buffers to resolve differences using `:diffget` (or `do`) and `:diffput` (or `dp`), including how to use ranges and buffer specifications. It also addresses edge cases, such as dealing with deleted lines and read-only buffers, and provides examples for using buffer specifications with `:diffget`.