The official Neovim companion for difi.
- 🚀 Auto-Open: Seamlessly jumps from the CLI to the exact line in your editor.
- 👁️ Visual Diffs: GitHub-style inline highlighting—no cramped split views.
- 🛠️ Interactive: Confirm or reject changes by simply editing the buffer text.
- 🔗 Synced: Automatically respects your CLI diff target (e.g.,
mainorHEAD~1). - 🧹 Smart Filtering: Uses histogram diffing to reduce noise and whitespace clutter.
{
"oug-t/difi.nvim",
event = "VeryLazy",
keys = {
-- Context-aware: Syncs with CLI target (e.g. main) or defaults to HEAD
{ "<leader>df", ":Difi<CR>", desc = "Toggle Difi" },
},
},This plugin shines when paired with the difi CLI tool.
- Run
difi(ordifi main) in your terminal. - Navigate to a file and press
e. - Neovim opens the file with the diff overlay already active, scrolled to the exact line you were viewing.
You can also use it standalone inside Neovim:
:Difi— Toggle diff againstHEAD.:Difi main— Toggle diff against themainbranch.:Difi HEAD~1— Compare against the previous commit.
difi.nvim turns your buffer into an editable diff. You confirm or reject changes by simply editing the text.
| Action | How to do it | Result |
|---|---|---|
| Accept Addition | Do nothing | The + marker is stripped, keeping the green line. |
| Reject Addition | Delete the line (dd) |
The new code is removed completely. |
| Confirm Deletion | Do nothing | The red line (starting with -) disappears. |
| Restore Deletion | Delete the - marker |
The text is kept and the line becomes normal code. |
| Fix a Typo | Edit the text directly | Your changes are saved as the new version. |
When you are done, run :Difi (or your toggle keymap) again. The plugin will clean up the markers and leave you with the final file state.
The plugin works out of the box with zero configuration. However, you can check the health of the integration at any time:
:DifiHealth- MIT
Made with ❤️ by oug-t
