A Hunk extension that shows the selected file in a pinned sidebar.
Requires Hunk 0.19.0 or later.
hunk extension install astwys/hunk-diff-contextFor a one-off local test:
hunk diff --extension .Press Ctrl+O to open, switch, or close the right-side pane:
- With the pane closed, it opens the selected file and hunk.
- With the pane open, pressing
Ctrl+Oon the same hunk closes it. - Pressing
Ctrl+Oon another file or hunk replaces the pinned sidebar contents.
The sidebar stays pinned while you navigate. Selection changes alone do not update it.
The default shortcut is Ctrl+O. Remap it in Hunk's [keybindings]
configuration, in ~/.config/hunk/config.toml or .hunk/config.toml:
[keybindings]
"hunk-diff-context.toggle-diff-context" = "ctrl+shift+o"Set the value to false to disable the command.
The sidebar renders a complete, syntax-highlighted unified diff, including unchanged, added, and removed lines.
Hunk's z shortcut changes the primary review view. This extension keeps the
normal Hunk view visible and adds a pinned complete-file diff beside it:
Hunk z |
Hunk Diff Context |
|---|---|
| Changes the primary review view | Adds a right-side pane |
| Uses the current review position | Pins the selected file and hunk |
| Replaces the current view temporarily | Keeps Hunk's files pane and hunk view intact |
| Shows the file in Hunk's normal view | Shows a complete unified diff with unchanged lines |
git clone https://github.com/astwys/hunk-diff-context.git
cd hunk-diff-context
pnpm install
pnpm test
pnpm typecheck
pnpm devpnpm dev runs hunk diff --extension . against the local checkout.
