DiffTerm is a terminal-based, side-by-side text diff tool designed for developers who work in the terminal—especially those collaborating with AI.
I created DiffTerm after noticing that AI-generated code often contains subtle mistakes or deviations from instructions. With DiffTerm, you can instantly compare two text blocks and visually spot changes at a glance—making AI-assisted coding safer, faster, and more reliable.
When coding in the terminal with AI, it's common to get code suggestions or completions that aren't exactly what you intended.
DiffTerm lets you:
- Instantly paste and compare original and AI-generated code.
- See additions and deletions with clear color highlights, right in your terminal.
- Quickly verify if the AI followed your instructions, line by line.
- Side-by-side Editing:
Two panes for "Original" and "Updated" text, each with live line counting. - Live Diff Visualization:
The bottom panel instantly shows the diff, with removed and added text. - Intuitive Controls:
- TAB: Switch panes
- Delete: Clear both panes and diff
- Ctrl+C or Esc: Exit
- Mouse Support:
Full mouse and keyboard interaction. - Paste Support:
Paste large chunks of text with ease. - Legend:
Always-visible color legend for clarity.
- Red text = Removed text
- Green text = Added text
(If your Markdown viewer doesn’t support color, you’ll see regular text. In the terminal, colors are always shown.)
- Go 1.19+ (or newer)
go get github.com/rivo/tview
go get github.com/gdamore/tcell/v2
go get github.com/sergi/go-diff/diffmatchpatch
go run main.go
or
go build -o diffterm && ./diffterm
- Type or paste text into the "Original" and "Updated" panes.
- See differences live in the bottom panel.
- Use TAB to switch focus, Delete to clear, Ctrl+C/Esc to quit.