SkillAgentSearch skills...

Diffmantic.nvim

Semantic Diff Engine for Neovim Using Tree-sitter

Install / Use

/learn @HarshK97/Diffmantic.nvim
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

<p align="center"> <picture> <source media="(prefers-color-scheme: dark)" srcset="assets/logo-dark.png"> <img alt="Diffmantic Logo" src="assets/logo-light.png"> </picture> </p>

Semantic diff for Neovim using Tree-sitter. Understands code structure to detect moved functions, updated blocks, and real changes, not just line differences.

Demo

Features

  • Move detection — Knows when code blocks are moved, not deleted and re-added
  • Update detection — Highlights modified code in place
  • Insert/Delete detection — Shows new and removed code
  • Rename detection — Shows renamed variables and functions
  • Language agnostic — Works with languages that have Tree-sitter parsers and diffmantic query support

Installation

Using lazy.nvim:

{
    "HarshK97/diffmantic.nvim",
    config = function()
        require("diffmantic").setup()
    end,
}

Usage

Compare two files:

:Diffmantic path/to/file1 path/to/file2

Compare current buffer with another file:

:Diffmantic path/to/other_file

How It Works

The current core follows a multi-phase AST matching pipeline:

  1. Pre-match — Seeds stable mappings from unchanged lines
  2. Top-down matching — Finds identical/high-confidence subtree pairs
  3. Bottom-up matching — Expands matches using mapped descendants
  4. Recovery matching — Iteratively recovers remaining valid mappings
  5. Action generation + analysis — Produces move/update/insert/delete actions and refined hunks

Requirements

  • Neovim 0.9+
  • Tree-sitter parser for the language you're diffing

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgements

Related Skills

View on GitHub
GitHub Stars107
CategoryDevelopment
Updated1d ago
Forks0

Languages

Lua

Security Score

100/100

Audited on Mar 25, 2026

No findings