Diff
Diff the two things you just copied
palupdated 2026-09-29DeveloperIn pal's registry5 deep links
In pal's registry: the button shows it in pal, which asks before installing; the command does the same from a terminal. This page can't see what your pal has installed.




What it does
Compare the two things you copied last, with changed lines tinted and the differing words marked. Also diff the clipboard against a selection, any two history entries, or two files.
- Opens on the two newest text copies, the older on the left
- Other pairs: the clipboard against the selection (
e), two history entries (h), two files (f) - Changed words marked inside each line; unified or side by side (
s);wignores whitespace - Unchanged stretches fold away;
tabwalks them,spaceexpands one entercopies the unified diff;oopens both sides in VS Code, kitty, FileMerge or Meld
Palettes 2
-
Diff
diffviewThe two newest copies diffed; keys for other pairs, side by side, whitespace, the folds, the tool.
- ↵Copy the unified diff
- OOpen both sides in the external tool
- SSide by side, or unified
- WIgnore whitespace, or mind it
- XSwap the sides
- LCopy the left text
- RCopy the right text
- ⇥Next fold (shift+tab: previous)
- spaceExpand the fold under the cursor
- AExpand every fold
- NThe two newest copies
- EThe clipboard against the selection
- HPick two entries from the history
- FTwo files
-
Diff from History
pickinputThe clipboard history's text entries: pick the left side, then the right; or mark two and press Enter.
- ↵Pick this side (with two marked: diff them)
- ⇥Mark the entry (x with nothing typed)
Actions
- Copy unified diff↵
- Open in external toolThe two sides as files in VS Code, kitty, FileMerge, Meld or the custom command.O
- Side by side / UnifiedS
- Ignore whitespace / Mind whitespaceLeading and trailing whitespace on a line does not count.W
- Swap sidesX
- Copy left textL
- Copy right textR
- Expand the fold under the cursor
tabandshift+tabmove the cursor over the folds;aexpands every fold; a click expands one.space - Diff the two newest copiesN
- Clipboard vs selectionE
- Pick two from history…H
- Two files…F
Links 5
Diff answers these pal:// routes from a web page, a script or a keybind; pal call is the same route from a terminal. A link from a page asks first unless you trust the extension. How links work.
-
Diff the two newest text copies in the clipboard history
clipboardpal call diff/clipboard -
Diff the clipboard against the selection in the app in front
selectionpal call diff/selection -
Diff two files
filespal call diff/files left=<left> right=<right>left*The left file's path (~ allowed)right*The right file's path
-
Diff two texts given in the link
textpal call diff/text left=<left> right=<right>left*The left textright*The right textleft_labelWhat to call the left sideright_labelWhat to call the right side
-
Diff two clipboard history entries by id
historypal call diff/history left=<left> right=<right>left*The left entry's idright*The right entry's id
Settings
Extension, [extensions.diff]
toolWhat `o` opens the two sides in. Auto takes the first installed of VS Code (`code --diff`), kitty (`+kitten diff`), FileMerge (`opendiff`, with Xcode) and Meld. One of auto, code, kitty, opendiff, meld, custom.
tool_commandWith the custom tool: the command line, `{left}` and `{right}` standing for the two files (a quoted argument stays whole).
Defaults shown. Change them in pal's settings window or in the config file.
The README
Everything Diff does, key by key, from the extension's own README.md
Diff
Diff what you copied. Open it and the two newest text entries of the clipboard history are compared, the older on the left: what changed on the way to the newer copy. Other pairs are a key away: the clipboard against the selection in the app in front, two entries picked from the history, two files.
The view
A header names both sides (− the left, + the right) with what they
are and when they were copied ("Deploy notes · 3 lines · copied 2 min
ago from kitty"), and the counts as badges: +12 green, −4 red,
whitespace only amber when every change is whitespace, no differences when there are none. Under it a keycap line with the keys
in use, then the lines on a sunken surface:
- Unified (the default): both line numbers in the gutter, the sign,
the text in monospace. Removed lines sit on a red tint, added ones on
a green one; consecutive lines of one kind share the block, so a
change reads as one. Inside a removed/added pair that still shares
most of its words, the words that differ are marked on a stronger
tint (a pair that shares under 40% is drawn plain). A pair that
differs in whitespace alone carries a
whitespacetag. - Side by side (
s): a cell per side, the same tints, an empty cell where a line was only removed or only added. - Folds: a run of unchanged lines longer than the 3 lines of context
kept on each side of a change folds to one row, "⋯ 16 unchanged
lines".
tabandshift+tabmove a cursor over the folds (an accent ring),spaceexpands the one under it,aexpands them all, a click expands one. - A very long diff is cut where the host's node cap would be reached and says so; Copy unified diff has the whole thing.
The tints are fixed colours at a low alpha, so they read on both themes with the panel's own ink.
| keys | action |
|---|---|
enter |
Copy the unified diff (--- left, +++ right, the hunks, 3 lines of context) |
o (cmd+enter) |
Open both sides in the external tool |
s |
Side by side, or unified |
w |
Ignore whitespace (as diff -w: none of it counts, the newline at the end included), or mind it |
x |
Swap the sides |
l, r |
Copy the left or the right text |
tab, shift+tab |
Next, previous fold |
space |
Expand the fold under the cursor (a: every fold) |
n |
The two newest copies again |
e |
The clipboard against the selection |
h |
Pick two entries from the history |
f |
Two files (a form: two paths, ~ allowed) |
escape |
Back |
n and e replace the sides in the same level; h and f open a new
level over it, so escape comes back to the diff you had.
Sources
- The two newest copies: the newest two text entries of the history (images and file lists skipped). With fewer than two the view says so.
- Clipboard vs selection: what is on the clipboard now (the history
entry for it, else the newest text entry) on the left, the selection
in the app in front on the right (
selection.text(), Accessibility on macOS); nothing selected is said in the view. The header names the app the selection is in. - From history (
h, theDiff from Historypalette,diff-pick): the history's text entries, searchable.enteron one takes it as the left side and lists the rest for the right; or mark two (tab, orxwith nothing typed) andenterdiffs them, the first marked on the left. The Clipboard History palette has the same two actions on a text entry:Diff with…and, with two marked,Diff these two(cmd+shift+f). - Two files (
f): a form with two paths; a missing file, a folder or a binary is refused under its field. A file over 1 MB is not read into the panel (the external tool takes it).
The external tool
o writes each side that is not already a file under
~/Library/Caches/pal/diff/ ($XDG_CACHE_HOME/pal/diff on Linux),
named after its label, and opens the pair in the tool setting: Auto
takes the first installed of VS Code (code --diff), kitty (kitty +kitten diff, the app on macOS), FileMerge (opendiff, with Xcode) and
Meld; custom runs tool_command with {left} and {right} filled in
(a quoted argument stays whole): nvim -d {left} {right} in a terminal
wrapper, delta {left} {right}. No tool at all is a toast naming what to
install.
Links
| link | what |
|---|---|
pal://diff/clipboard |
The two newest copies |
pal://diff/selection |
The clipboard against the selection |
pal://diff/files?left=~/a&right=~/b |
Two files |
pal://diff/text?left=…&right=…&left_label=…&right_label=… |
Two texts given in the link |
pal://diff/history?left=<id>&right=<id> |
Two history entries by id |
Each opens the panel on the diff. pal call diff/files left=a right=b
is the command form.
Settings, [extensions.diff]
| key | type | default | what |
|---|---|---|---|
tool |
auto, code, kitty, opendiff, meld, custom |
auto |
What o opens the sides in. |
tool_command |
text | empty | With custom: the command line, {left} and {right} the two files. |
For the tests, PAL_DIFF_PATH is a directory searched for the tools
instead of PATH, PAL_DIFF_CACHE the folder the sides are written to.
What it does not do
- Three-way merges, or editing either side: it reads. Open the tool for that.
- Diffing images or file lists: text entries only; a pick of another kind says so.
- Syntax colouring inside the lines.
The diff is jsdiff (diff on npm,
BSD-3-Clause): its line diff with one change per line, its word diff
for the spans, its patch writer for the unified text.
Platforms
macOS and Linux.