Diff Mode

vimdiff and :diffthis โ€” visualize and edit changes side-by-side.

Keys: ]c, [c, do, dp

Vim has a built-in diff view: vimdiff a b opens two files in vertical splits with synchronized scrolling and highlighted differences. ]c and [c jump between hunks; do and dp pull and push changes.

Vim has a real diff tool baked in. Launch with vimdiff a b from the shell, or :diffsplit other.txt to compare with the current buffer.

Key Action
]c Jump to next change
[c Jump to previous change
do Diff Obtain โ€” pull change from the other file
dp Diff Put โ€” push change to the other file
`:diffupdate` Re-scan for changes after edits
`:diffoff` Exit diff mode for current buffer

Watch

See also: The [ and ] Family