Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 24 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Diffview.nvim

> **Note:** This is an **actively maintained fork** of [sindrets/diffview.nvim](https://github.com/sindrets/diffview.nvim) with bug fixes and improvements applied. The original repository has not been updated since June 2024.
> **Note:** This is an **actively maintained fork** of [sindrets/diffview.nvim](https://github.com/sindrets/diffview.nvim) with bug fixes and improvements applied. The original repository has not been updated since June 2024. See [`doc/diffview_changelog.txt`](doc/diffview_changelog.txt) (`:h diffview.changelog`) for breaking changes and notable additions.

## Introduction

Expand Down Expand Up @@ -83,13 +83,28 @@ and committing workflows.
right side). Once you write to an index buffer the index will be updated.
(Note: Staging is a Git concept. These actions are no-ops on Jujutsu.)

- **Unified Inline Diff** — `diff1_inline` layout renders adds/deletes
in a single window via extmark overlays, with tree-sitter highlights
preserved on both added and deleted lines. Configurable via
`view.inline.style` (`"unified"` / `"overleaf"`).

- **Multi-file Selection** — Select multiple files in the file panel
(`w` to toggle, `C` to clear) for batch stage / unstage / restore.
Selections persist across Neovim restarts.

- **Pin Local in File History** — Run `:DiffviewFileHistory --pin-local`
to keep the working tree on one side while cycling commits on the
other (Git only).

## Commands

| Command | Description |
|---|---|
| `:DiffviewOpen [rev] [options] [ -- {paths...}]` | Open a diff view |
| `:DiffviewFileHistory [paths] [options]` | Browse file/commit history |
| `:DiffviewDiffFiles {file1} {file2}` | Diff two arbitrary files |
| `:DiffviewMergeFiles {output} [{base}] {left} {right}` | 3-way / 4-way merge editor (no VCS required) |
| `:DiffviewDiffDirs {left} {right} [{output}]` | Compare two on-disk directories (no VCS required) |
| `:DiffviewClose` | Close the current diffview. You can also use `:tabclose`. |
| `:DiffviewToggleFiles` | Toggle the file panel |
| `:DiffviewFocusFiles` | Bring focus to the file panel |
Expand All @@ -108,10 +123,14 @@ Examples:

#### VCS Adapter Notes

- **Jujutsu** supports `:DiffviewOpen` and `:DiffviewFileHistory`, but not
`--pin-local` or line-range history (`:'<,'>DiffviewFileHistory`). The
options `--cached`, `--staged`, and `--imply-local` are Git-only. In
colocated repos, set `preferred_adapter = "jj"` to use the Jujutsu adapter.
- **Jujutsu** supports `:DiffviewOpen`, `:DiffviewFileHistory`, and works as
jj's external merge tool (`:DiffviewMergeFiles`) and diff editor
(`:DiffviewDiffDirs`); see `:h :DiffviewMergeFiles` and
`:h :DiffviewDiffDirs` for `~/.config/jj/config.toml` wiring. The options
`--cached`, `--staged`, `--imply-local`, the `--pin-local` flag, and
line-range history (`:'<,'>DiffviewFileHistory`) are not supported;
staging actions are no-ops (jj has no staging index). In colocated
repos, set `preferred_adapter = "jj"` to use the Jujutsu adapter.
- **Sapling** is detected automatically through the Mercurial adapter. Use
`hg_cmd` to configure the executable (e.g. `hg_cmd = { "sl" }`).
- **Perforce** support is experimental. Requires the `p4` CLI ≥ 2019.1
Expand Down
118 changes: 117 additions & 1 deletion doc/diffview_changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,123 @@

CHANGELOG

NOTE: This changelog only encompasses breaking changes.
NOTE: Breaking changes and notable feature additions are listed here.

*diffview.changelog-jj-adapter*

ISSUE: https://github.com/sindrets/diffview.nvim/issues/562

The Jujutsu (jj) adapter supports `:DiffviewOpen` and
`:DiffviewFileHistory` end-to-end, and implements `file_restore` via
`jj restore --from <commit> -- <path>` (with `jj op undo` as the
suggested undo).

Configure log options under `file_history_panel.log_options.jj` the
same way as `git`/`hg`. Supported flags: `--revisions <revset>`,
`--limit <n>`, `--reversed`.

Staging-related actions (`s`/`S`/`U`, restoring from "staged") are
no-ops in jj — there is no staging index. The adapter surfaces a
one-time warning when these are invoked instead of failing silently.

The `--pin-local` flag, the line-range `[range]:DiffviewFileHistory`
form, and the `--cached`/`--staged`/`--imply-local` options remain
Git-only.

In colocated repos, set `preferred_adapter = "jj"` to use the Jujutsu
adapter instead of Git.

*diffview.changelog-out-of-vcs-views*

ISSUES: https://github.com/sindrets/diffview.nvim/issues/562,
https://github.com/sindrets/diffview.nvim/issues/286

Two new commands open diff views that don't query any VCS, suitable as
external editor entry points for tools like jj's merge tool and diff
editor (and for ad-hoc use). They are also the integration point that
closes issue 286 in the sindrets repo (arbitrary directory
diffing).

`:DiffviewMergeFiles {output} [{base}] {left} {right}` opens a 3-way or
4-way merge editor backed by on-disk file paths. `{output}` is the
editable buffer; the other paths are read-only. See `:h :DiffviewMergeFiles`
for the `~/.config/jj/config.toml` wiring.

`:DiffviewDiffDirs {left} {right} [{output}]` opens a side-by-side diff
of two on-disk directories (no VCS involvement); when `{output}` is
provided the middle buffer points at `{output}/<rel>` and edits flow
back there. See `:h :DiffviewDiffDirs` for jj's `diff-editor` wiring.

*diffview.changelog-new-adapters*

Two additional VCS adapters are supported beyond `git` and `hg`:

- **Sapling**, detected automatically through the Mercurial adapter.
Use `hg_cmd` to configure the executable (e.g. `hg_cmd = { "sl" }`).

- **Perforce** (experimental), via the `p4` CLI. Requires `p4` >=
2019.1 and the environment variables `P4PORT`, `P4USER`, `P4CLIENT`.
Configure log options under `file_history_panel.log_options.p4`.

See also |diffview.changelog-jj-adapter| for the Jujutsu adapter.

*diffview.changelog-breaking-panel-show*

PR: https://github.com/dlyongemallo/diffview.nvim/pull/165

`file_panel.show` previously controlled both `:DiffviewOpen` and
`:DiffviewFileHistory`. Visibility is now split: set `file_panel.show`
for diff views and the new `file_history_panel.show` (default `true`)
for file-history views.

*diffview.changelog-pin-local*

PR: https://github.com/dlyongemallo/diffview.nvim/pull/158

The new `:DiffviewFileHistory --pin-local` flag pins the right-hand
side of the diff to the working-tree copy of the followed path while
the left-hand side cycles through commits. Useful for reviewing how a
file has evolved against its current state.

Configurable via `view.file_history.pin_local`. Multi-file pinning is
supported through a synthetic `LOCAL` log entry at the top of history.
Git only. Cannot be combined with `--base`.

*diffview.changelog-diff1-inline*

PR: https://github.com/dlyongemallo/diffview.nvim/pull/120

The new `diff1_inline` layout renders unified diffs in a single window
via extmark overlays. Tree-sitter highlights are preserved on both
added text and deleted virt_lines.

Style is configurable via `view.inline.style`:

- `"unified"` (default): standard unified diff appearance.
- `"overleaf"`: inline strikethrough for deletions.

Deletion highlight is configurable via `view.inline.deletion_highlight`.

*diffview.changelog-multi-selection*

PRs: https://github.com/dlyongemallo/diffview.nvim/pull/36,
https://github.com/dlyongemallo/diffview.nvim/pull/45,
https://github.com/dlyongemallo/diffview.nvim/pull/46

The file panel supports multi-file selection for batch operations.
Default keymaps: `w` to toggle a selection on the current file, `C`
to clear all selections. Staging, unstaging, restore, and similar
actions operate on the selection when present.

Selections persist across Neovim restarts. Selection marks and their
placement are configurable via `file_panel.mark_placement` and
`file_panel.always_show_marks`.

*diffview.changelog-breaking-nvim-010*

PR: https://github.com/dlyongemallo/diffview.nvim/pull/11

The minimum required Neovim version has been bumped to 0.10.

*diffview.changelog-271*

Expand Down
Loading