Apply a patch and show differences
Example
Normal 0 / 2Command-line 1 / 2Normal 2 / 2oldCursor on line 1, column 1oldCursor on line 1, column 1newCursor on line 1, column 1Apply a patch and show differences.
Windows
- old.txt Active
old
Command entered · ready to apply
Windows
- old.txt Active
old
Command line
- Typed text
:diffpatch change.patch- Insertion offset
23
:diffpatch applies the single-file patch to a copy and opens the new result in a diff split; old.txt stays intact.
Windows
- old.txt
old
- Patched result Active
new
Diff regions
- Line 1
old ↔ new
Before & after
oldCursor on line 1, column 1Windows
- old.txt Active
old
newCursor on line 1, column 1Windows
- old.txt
old
- Patched result Active
new
Diff regions
- Line 1
old ↔ new
Documentation-backed illustration. +diff, unrestricted mode, splitbelow, diffopt without vertical, a working patch program or equivalent patchexpr, and this exact single-file patch. :diffpatch applies the single-file patch to a copy and opens the new result in a diff split; old.txt stays intact. Primary help: :diffpatch.
Details & Vim help
Apply a patch and show differences. This Ex reference uses the full command name; the alphabetical index omits arguments. Supply the ranges, arguments, flags and prerequisite state documented in the linked help. Press Enter to submit a complete command. The index spelling :diffp[atch] puts the optional abbreviation suffix in square brackets; those brackets are not typed. Availability and exact behavior can depend on Vim build features, options, mappings and editor state; the linked help is authoritative.