Diffmantic.nvim
Semantic Diff Engine for Neovim Using Tree-sitter
Install / Use
/learn @HarshK97/Diffmantic.nvimREADME
Semantic diff for Neovim using Tree-sitter. Understands code structure to detect moved functions, updated blocks, and real changes, not just line differences.

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:
- Pre-match — Seeds stable mappings from unchanged lines
- Top-down matching — Finds identical/high-confidence subtree pairs
- Bottom-up matching — Expands matches using mapped descendants
- Recovery matching — Iteratively recovers remaining valid mappings
- 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
- GumTree repository: https://github.com/GumTreeDiff/gumtree
- GumTree paper: https://hal.science/hal-04855170v1/file/GumTree_simple__fine_grained__accurate_and_scalable_source_differencing.pdf
- Beyond GumTree paper: https://www.researchgate.net/publication/335498580_Beyond_GumTree_A_Hybrid_Approach_to_Generate_Edit_Scripts
Related Skills
node-connect
338.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
83.4kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
338.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
83.4kCommit, push, and open a PR
