I'm trying to use vimdiff+dirdiff.vim to diff inside Vim multiple files versionned with Git.
For Mercurial, it is possible with mercurial extdiff extension.
The only way I found on the web to integrate Vim with Git diff is to use vimdiff on a singe file, as describe in this post.
Does any one know how to use vimdiff+dirdiff+git?
Description. Vimdiff starts Vim on two (or three or four) files. Each file gets its own window. The differences between the files are highlighted. This is a nice way to inspect changes and to move changes from one version to another version of the same file.
git-diffall
is what I need, thanks a lot. With help of this page about git difftool and this one about running vim+dirdiff from command line, I wrote my $HOME/.gitconfig
as:
[diff] tool = default-difftool [difftool "default-difftool"] cmd = vim -f '+next' '+execute \"DirDiff\" argv(0) argv(1)' $LOCAL $REMOTE [difftool] prompt = false
After putting git-diffall
in my PATH
, I can diff for example working directory with branch dev
with:
git diffall dev
The --copy-back
is also what I need if I want to modify the working directory persitantly from Vim:
git diffall --copy-back dev
Since version 1.7.11, "git difftool" learned the "--dir-diff" option that simplify things and git-diffall
is no longer needed.
.gitconfig
contains:
[diff] tool = default-difftool [difftool "default-difftool"] cmd = vim -f '+next' '+execute \"DirDiff\" argv(0) argv(1)' $LOCAL $REMOTE '+syntax off'
And diffing for example working directory with branch dev
is done with:
git difftool -d dev
Tim Pope's fugitive is the quintessential git plug-in for vim. It might not have dirdiff's functionality, but it does integrate git status
output beautifully, with key mappings to easily navigate between modified files. Any files listed in your git status
output can then easy be diffed with the D mapping, allowing you to customise the exact changes going into your changes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With