Skip to content

xguot/difi.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

difi.nvim

The official Neovim companion for difi.

difi_demo

Features

  • 🚀 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., main or HEAD~1).
  • 🧹 Smart Filtering: Uses histogram diffing to reduce noise and whitespace clutter.

(back to top)

Installation

{
    "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" },
    },
},

(back to top)

Usage

1. The CLI Workflow (Recommended)

This plugin shines when paired with the difi CLI tool.

  1. Run difi (or difi main) in your terminal.
  2. Navigate to a file and press e.
  3. Neovim opens the file with the diff overlay already active, scrolled to the exact line you were viewing.

(back to top)

2. Manual Usage

You can also use it standalone inside Neovim:

  • :Difi — Toggle diff against HEAD.
  • :Difi main — Toggle diff against the main branch.
  • :Difi HEAD~1 — Compare against the previous commit.

(back to top)

Interactive Review Guide

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.

(back to top)

Configuration

The plugin works out of the box with zero configuration. However, you can check the health of the integration at any time:

:DifiHealth

(back to top)

License

  • MIT

(back to top)


Made with ❤️ by oug-t

About

The official Neovim companion for difi

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages