(dir)VimDiff as GIT difftool

Tig blame + VIM showing all files of a GIT commit in diff-tabs using dirvimdiff
I configured GIT's difftool command to show the changed files as diff-split file tabs I can easily cycle through by pressing gt.
This makes for a good terminal-based meld/beyond compare/... alternative.
Combined with Tig, it allows to quickly inspect a GIT commit's modifications in file context, let's take a look at the quick and simple steps to set it up.
The history of DirVimDiff
After 12+ years of perforce on the job, I get to use GIT on the main codebase again. Back then, I adapted a script called svnvimdiff to show GIT commits. I extended it to show an entire commit in a VIM window with every file in a tab. I called it Gitvimdiff, but actually it doesn't work all that great, so these days I opt to use my dirvimdiff as git difftool. Also, I once wrote a python script to do the same with perforce changelists.
Dirvimdiff is a quite simple hack at the time of writing, it converts the output of diff to a VIM-script that opens tabs with diff-splits of changed files. Then it launches Vim.
Setting up dirvimdiff / vimdiff in GIT
First, download dirvimdiff from my github scriptbox repository, and put it somewhere in your shell search $PATH.
Next, add these chunks to your ~/.gitconfig file:
[diff]
tool = vimdiff
[difftool "dirvimdiff"]
cmd = dirvimdiff $LOCAL $REMOTE
[alias]
vimdiff = difftool --dir-diff --no-symlinks --tool=dirvimdiff
Now you can use git vimdiff next to git difftool:
thomas@roper thouters.be % git difftool HEAD~1
(triggers tool in [diff] -> launch vimdiff one by one)
thomas@roper thouters.be % git vimdiff HEAD~1
(triggers the [alias] -> launch dirvimdiff, one VIM with tabs)

VIM showing all files of a GIT commit in diff-tabs using dirvimdiff
Configuring Tig
Tig is an ncurses-based text-mode interface for git. It functions mainly as a GIT repository browser, but can also assist in staging changes for commit at chunk level and act as a pager for output from various GIT commands.

Walking through GIT commits using Tig blame. Hit F5 to launch dirvimdiff.
To use the dirvimdiff based difftool in tig, you can add this to your ~/.tigrc:
bind status <F4> !git difftool -y %(commit) %(file) bind generic <F5> !git vimdiff %(commit)~1 %(commit)
Liked something? Worked on something similar? Let me know what you think on Mastodon!
You can use your Mastodon account to reply to this post.