Note: This is an actively maintained fork of sindrets/diffview.nvim with bug fixes and improvements applied. The original repository has not been updated since June 2024.
Single tabpage interface for easily cycling through diffs for all modified files for any git rev. Review all changed files, resolve merge conflicts, and browse file history from a unified view.

Supported VCS (at least one required):
:DiffviewOpen only; file history is not yet supported)p4 CLI (experimental)-- Lazy
{
"dlyongemallo/diffview.nvim",
version = "*",
-- optional: lazy-load on command
-- cmd = {
-- "DiffviewOpen",
-- "DiffviewToggle",
-- "DiffviewFileHistory",
-- "DiffviewDiffFiles",
-- "DiffviewLog",
-- },
}
" Plug
Plug 'dlyongemallo/diffview.nvim'
:DiffviewOpen " Diff working tree against index
:DiffviewFileHistory % " History for the current file
:DiffviewFileHistory " History for the whole repo
:DiffviewDiffFiles a b " Diff two arbitrary files
:DiffviewClose " Close the current diffview
Press g? in any diffview buffer to see all available keymaps.
See USAGE.md for detailed guides on PR review, stash inspection, and committing workflows.
Diff View — Browse all changed files in a single tabpage. Stage
individual hunks by editing index buffers directly.

File History — List all commits affecting a file, directory, or line
range. Filter by author, message, date range, and more.

Merge Tool — 3-way and 4-way diff layouts for resolving conflicts,
with mappings for choosing OURS/THEIRS/BASE versions.

Staging — Stage and unstage individual files or all changes from the
file panel (- / s / S / U). You can stage individual hunks by
editing any buffer that represents the index (after running :DiffviewOpen
with no [rev] the entries under "Changes" will have the index buffer
on the left side, and the entries under "Staged changes" will have it on the
right side). Once you write to an index buffer the index will be updated.
| Command | Description |
|---|---|
:DiffviewOpen [rev] [options] [ -- {paths...}] |
Open a diff view |
:DiffviewFileHistory [paths] [options] |
Browse file/commit history |
:DiffviewDiffFiles {file1} {file2} |
Diff two arbitrary files |
:DiffviewClose |
Close the current diffview. You can also use :tabclose. |
:DiffviewToggleFiles |
Toggle the file panel |
:DiffviewFocusFiles |
Bring focus to the file panel |
:DiffviewRefresh |
Update stats and entries in the file list |
Examples:
:DiffviewOpen " Working tree changes
:DiffviewOpen HEAD~2 " Changes since HEAD~2
:DiffviewOpen origin/main...HEAD " Symmetric diff (PR-style)
:DiffviewOpen -- lua/diffview " Limit to specific paths
:DiffviewFileHistory % " Current file history
:'<,'>DiffviewFileHistory " History for selected lines
:DiffviewOpen. The options --cached,
--staged, and --imply-local are Git-only. In colocated repos, set
preferred_adapter = "jj" to use the Jujutsu adapter.hg_cmd to configure the executable (e.g. hg_cmd = { "sl" }).p4 CLI ≥ 2019.1
and the environment variables P4PORT, P4USER, P4CLIENT.For full command documentation, see :h diffview-commands.
[!IMPORTANT]
Familiarize Yourself With
:h diff-modeThis plugin builds on nvim's built-in diff mode. Make sure you're familiar with jumping between hunks (
:h jumpto-diffs) and applying diff changes (:h copy-diffs).
A minimal configuration showing commonly customised options:
require("diffview").setup({
enhanced_diff_hl = true,
use_icons = true,
view = {
default = { layout = "diff2_horizontal" },
merge_tool = { layout = "diff3_horizontal" },
},
file_panel = {
listing_style = "tree",
win_config = { position = "left", width = 35 }, -- Use "auto" to fit content
},
hooks = {}, -- See :h diffview-config-hooks
keymaps = {}, -- See :h diffview-config-keymaps
})
For the full list of options with defaults, see
doc/diffview_defaults.txt or run
:h diffview.defaults in Neovim.
See RECIPES.md for ready-to-use configuration snippets covering PR review, merge conflicts, file history, and more.
watch_index is enabled (the default), the file panel
refreshes instantly after staging or unstaging hunks via gitsigns.integrations = { diffview = true }).See TIPS.md for setup details and known compatibility issues.
See TIPS.md for common usage patterns, revision argument guide, LSP diagnostics in diffs, platform notes, and plugin compatibility.
| Resource | Description |
|---|---|
| USAGE.md | PR review, stash inspection, committing guides |
| RECIPES.md | Configuration snippets and recommended keymaps |
| TIPS.md | Tips, FAQ, and known compatibility issues |
:h diffview |
Full plugin documentation |
:h diffview.defaults |
Complete default configuration |