Work with diff hunks. Part of 'mini.nvim' library.
Repo nvim-mini/mini.diff, read from GitHub 1 min ago. nvim-mini has not joined Take My Repo.
nvim-mini/mini.diff is a public repo on GitHub by nvim-mini. Work with diff hunks. Part of 'mini.nvim' library. It declares the MIT license on GitHub. It is written mainly in Lua, has 238 stars and last changed on 2026-11-20. Nobody has reviewed it on Take My Repo yet, which says nothing about its quality. Read from GitHub on 2026-11-22.
In the maintainer's words. Shown from GitHub; Take My Repo does not keep a copy.
See more details in Features and Documentation.
⦿ This is a part of mini.nvim library. Please use this link if you want to mention this module.
⦿ All contributions (issues, pull requests, discussions, etc.) are done inside of 'mini.nvim'.
⦿ See whole library documentation to learn about general design principles, disable/configuration recipes, and more.
⦿ See MiniMax for a full config example that uses this module.
If you want to help this project grow but don't know where to start, check out contributing guides of 'mini.nvim' or leave a Github star for 'mini.nvim' project and/or any its standalone Git repositories.
Visualize difference between buffer text and its configurable reference interactively (updates as you type). This is done per line showing whether it is inside added, changed, or deleted part of difference (called hunk). Visualization can be with customizable colored signs or line numbers.
Special toggleable overlay view with more hunk details inside text area.
Completely configurable per buffer source(s) of reference text used to keep it up to date and define interactions with it. Can be array of sources which are attempted to attach in order. By default uses Git source (buffer's file text from Git index as reference).
Configurable mappings to manage diff hunks:
What it doesn't do:
For more information see these parts of help:
:h MiniDiff-overview:h MiniDiff-source-specification:h MiniDiff-hunk-specification:h MiniDiff-diff-summaryThe "diff" (short for "difference") is a result of computing how two text strings differ from one another. This is done on per line basis, i.e. the goal is to compute sequences of lines common to both files, interspersed with groups of differing lines (called "hunks").
Although computing diff is a general concept (used on its own, in Git, etc.), this module computes difference between current text in a buffer and some reference text which is kept up to date specifically for that buffer. For example, default reference text is computed as file content in Git index. This can be customized in config.source.
MiniDiffSign* highlight group and sign text for "sign" style can be configured in config.view.signs.vim.b.minidiff_summary and vim.b.minidiff_summary_string buffer-local variables. These can be used, for example, in statusline.MiniDiffUpdated User event. See :h MiniDiff-diff-summary for example of how to use it.Notes:
:edit to reset (disable and re-enable) current buffer.Along with basic visualization, there is a special view called "overlay". Although it is meant for temporary overview of diff details and can be manually toggled via MiniDiff.toggle_overlay(), text can be changed with overlay reacting accordingly.
It shows more diff details inside text area:
Added buffer lines are highlighted with MiniDiffOverAdd highlight group.
Deleted reference lines are shown as virtual text and highlighted with MiniDiffOverDelete highlight group.
Changed reference lines are shown as virtual text and highlighted with MiniDiffOverChange highlight group.
"Change" hunks with equal number of buffer and reference lines have special treatment and show "word diff". Reference line is shown next to its buffer counterpart and only changed parts of both lines are highlighted with MiniDiffOverChange. The rest of reference line has MiniDiffOverContext highlighting.
This usually is the case when config.options.linematch is enabled.
This module provides mappings for common actions with diffs, like:
Examples:
vip followed by gh / gH applies/resets hunks inside current paragraph. Same can be achieved in operator form ghip / gHip, which has the advantage of being dot-repeatable.gh_ / gH_ applies/resets current line (even if it is not a full hunk).ghgh / gHgh applies/resets hunk range under cursor.dgh deletes hunk range under cursor.[H / [h / ]h / ]H navigate cursor to the first / previous / next / last hunk range of the current buffer.Mappings for some functionality are assumed to be done manually. See :h MiniDiff.operator().
Each enabled buffer has the following buffer-local variables which can be used in custom statusline to show an overview of hunks in current buffer:
vim.b.minidiff_summary is a table with the following fields:
source_name - name of the source.n_ranges - number of hunk ranges (sequences of contiguous hunks).add - number of added lines.change - number of changed lines.delete - number of deleted lines.vim.b.minidiff_summary_string is a string representation of summary with a fixed format. It is expected to be used as is. To achieve different formatting, use vim.b.minidiff_summary to construct one. The best way to do this is by overriding vim.b.minidiff_summary_string in the callback for MiniDiffUpdated event:
local format_summary = function(data) local summary = vim.b[data.buf].minidiff_summary local t = {} if summary.add > 0 then table.insert(t, '+' .. summary.add) end if summary.change > 0 then table.insert(t, '~' .. summary.change) end if summary.delete > 0 then table.insert(t, '-' .. summary.delete) end vim.b[data.buf].minidiff_summary_string = table.concat(t, ' ') end local au_opts = { pattern = 'MiniDiffUpdated', callback = format_summary } vim.api.nvim_create_autocmd('User', au_opts)
This plugin can be installed as part of 'mini.nvim' library (recommended) or as a standalone Git repository.
There are two branches to install from:
main (default, recommended) will have latest development version of plugin. All changes since last stable release should be perceived as being in beta testing phase (meaning they already passed alpha-testing and are moderately settled).stable will be updated only upon releases with code tested during public beta-testing phase in main branch.Here are code snippets for some common installation methods (use only one):
Full library
Follow 'mini.nvim' installation.
Standalone plugin
Main branch:
vim.pack.add({ 'https://github.com/nvim-mini/mini.diff' })
Stable branch:
vim.pack.add({ { src = 'https://github.com/nvim-mini/mini.diff', version = 'stable' }, })
Full library
Follow recommended 'mini.deps' installation.
Standalone plugin:
Main branch:
add('nvim-mini/mini.diff')
Stable branch:
add({ source = 'nvim-mini/mini.diff', checkout = 'stable' })
Full library
Follow 'mini.nvim' installation.
Standalone plugin
Main branch:
{ 'nvim-mini/mini.diff', version = false },Stable branch:
{ 'nvim-mini/mini.diff', version = '*' },Important: don't forget to call require('mini.diff').setup() to enable its functionality.
Note: if you are on Windows, there might be problems with too long file paths (like error: unable to create file <some file name>: Filename too long). Try doing one of the following:
git config --system core.longpaths true. Then try to reinstall.-- No need to copy this inside `setup()`. Will be used automatically. { -- Options for how hunks are visualized view = { -- Visualization style. Possible values are 'sign' and 'number'. -- Default: 'number' if line numbers are enabled, 'sign' otherwise. style = vim.go.number and 'number' or 'sign', -- Signs used for hunks with 'sign' view signs = { add = '▒', change = '▒', delete = '▒' }, -- Priority of used visualization extmarks priority = 199, }, -- Source(s) for how reference text is computed/updated/etc -- Uses content from Git index by default source = nil, -- Delays (in ms) defining asynchronous processes delay = { -- How much to wait before update following every text change text_change = 200, }, -- Module mappings. Use `''` (empty string) to disable one. mappings = { -- Apply hunks inside a visual/operator region apply = 'gh', -- Reset hunks inside a visual/operator region reset = 'gH', -- Hunk range textobject to be used inside operator -- Works also in Visual mode if mapping differs from apply and reset textobject = 'gh', -- Go to hunk range in corresponding direction goto_first = '[H', goto_prev = '[h', goto_next = ']h', goto_last = ']H', }, -- Various options options = { -- Diff algorithm (see `:h vim.text.diff()`) algorithm = 'histogram', -- Whether to use "indent heuristic" (see `:h vim.text.diff()`) indent_heuristic = true, -- The amount of second-stage diff to align lines linematch = 60, -- Whether to wrap around edges during hunk navigation wrap_goto = false, }, }
nvim-mini/mini.diff is a public repo on GitHub by nvim-mini. Work with diff hunks. Part of 'mini.nvim' library.
It declares the MIT license on GitHub.
Its maker tagged it for Windows. That is declared by the maker; Take My Repo has not tested it.
Open "Take it" on its page: Take My Repo writes an install plan for your machine and hands it to your AI agent (Claude Code, Codex or Cursor), which asks you before each step. Take My Repo has not tested it on any machine.
Its last change on GitHub was on 2026-11-20. GitHub counts 0 open issues and pull requests. Take My Repo does not judge from that whether it is maintained.
Nobody has reviewed it on Take My Repo yet, which says nothing about its quality.
Neovim config for the lazy
Library of 45+ independent Lua modules improving Neovim experience with minimal effort
Neovim Lua plugin with fast and feature-rich surround actions. Part of 'mini.nvim' library.
Navigate and manipulate file system. Part of 'mini.nvim' library.
Neovim Lua plugin to extend and create `a`/`i` textobjects. Part of 'mini.nvim' library.
This page is also available as structured data, with the same sources and dates.
/api/v1/resources/gh/nvim-mini/mini.diffTake My Repo has not tested this on your machine. Requirements come from the project's own documentation.