sindrets / diffview.nvim

Single tabpage interface for easily cycling through diffs for all modified files for any git rev.
Other
4k stars 109 forks source link

Directory Diffing #286

Open rgrinberg opened 1 year ago

rgrinberg commented 1 year ago

Would it be possible to view diffs using this plugin outside the context of VCS? In particular, I'd like to diff two directories and browse the diff using the diffview UI.

I'd like to replace my current use of https://github.com/will133/vim-dirdiff with this plugin

sindrets commented 1 year ago

We could potentially allow passing the --no-index flag to :DiffviewOpen which would solve this:

       git diff [<options>] --no-index [--] <path> <path>
           This form is to compare the given two paths on the filesystem. [...]

But I believe this would require a fair amount of refactoring, as a lot of the git adapter code requires a reference to a git repository.

I'll consider it in the future.

rgrinberg commented 1 year ago

Right, that would be pretty neat. It would also be pretty good to navigate a diff loaded from a patch file. It's not such a common workflow anymore, but I do run into patches from time to time.

Thanks for the great plugin!

sindrets commented 1 year ago

The patch file idea is interesting. Feel free to open an issue about it so that we can track it separately.

NeilGirdhar commented 1 year ago

This would be a fantastic change. I need to keep vim running just for dir-diff. (I can't use dir-diff with Neovim because it is confused by the folding https://github.com/will133/vim-dirdiff/issues/39.)

That said, if you do support dir-diffs, it would be great to somehow preserve the configuration files that guide linters and text editing, like: .editorconfig and pyproject.toml. Without these, linters are completely confused.