Vimdiff
Vim Text Editor Quick Reference
1 min read
This section is 1 min read, full guide is 16 min read
Published Jul 6 2025
11
Show sections list
0
Log in to enable the "Like" button
0
Guide comments
0
Log in to enable the "Save" button
Respond to this guide
Guide Sections
Guide Comments
LinuxText Editor
Diff mode in Vim stands for difference mode, which lets you compare two or more files side-by-side, highlighting their differences.
To open files in diff mode:
vim -d filename1 filename2
Copy to Clipboard
Alternatively you can use this instead of the -d
flag:
vimdiff filename1 filename2
Copy to Clipboard
Vim will:
- Split the window (usually vertically).
- Highlight added, removed, or changed lines.
- Enable special diff mappings for navigation and merging.
What you will see:
- Changes are highlighted (often in colour or with symbols like
>
or|
). - Matching lines are aligned side-by-side.
- You can edit either side interactively.
Diff mode commands
Key | Description |
---|---|
]c | Next difference |
]c | Previous difference |
do | Obtain the difference, (can also use :diffget) |
dp | Put the difference, (can also use :diffput) |
:dif | Re-scan the differences after edits, (can also use :diffupdate) |
:diffo | Switch off diff mode, (can also use :diffoff) |
ZQ | Quit without change |