Vimdiff

Vim Text Editor Quick Reference

1 min read

Published Jul 6 2025, updated Aug 17 2026


11
0
0
0

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

Alternatively you can use this instead of the -d flag:

vimdiff filename1 filename2

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

KeyDescription
]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

© 2025 SimpleSteps.guide
AboutFAQPoliciesContact