vimdiff: Interactive Diff in Vim
vimdiff opens two to four files in Vim side by side, highlighting differences and folding away identical regions for interactive review.
vimdiff (equivalently vim -d) is an interactive diff and merge editor. It is a local developer tool, not something to run in a headless pipeline.
What it does
vimdiff starts Vim in diff mode with the given files in split windows. Differing lines are highlighted, unchanged lines are folded, and Vim commands let you jump between changes and copy hunks from one side to the other: ]c and [c navigate, do (diff obtain) and dp (diff put) move a change between windows.
Common usage
vimdiff old.txt new.txt
# same thing via vim
vim -d fileA fileB
# inside vim: ]c next change, do pull change in, dp push change outOptions
| Command | What it does |
|---|---|
| vimdiff a b | Open two files in diff mode |
| vim -d a b c | Open up to four files in diff mode |
| ]c / [c | Jump to the next / previous change |
| do / dp | Diff obtain / diff put a change between windows |
| :diffupdate | Recompute the diff after edits |
In CI
vimdiff is interactive and needs a terminal, so it is not a CI tool. In a pipeline it will either error for lack of a TTY or hang waiting for input. Use diff, git diff, or difftastic for automated comparison and save vimdiff for resolving conflicts locally.
Common errors in CI
"Vim: Warning: Output is not to a terminal" followed by a hang is vimdiff started in a non-interactive job; do not run it there. "E97: Cannot create diffs" means no external diff was found on the PATH (Vim needs a diff binary on some platforms). For headless comparison, reach for git diff --no-index instead.