# Git alias to open all diffs in vim tabs

5 June, 2012

This is a handy little alias I’ve been using recently to open all unstaged diffs in a single instance of vim, one tab per file. Add the following to the [alias] section of your ~/.gitconfig:

 dt = "!f() { vim -p \$(git diff --name-only) +\"tabdo Gdiff [email protected]\" +tabfirst; }; f"

Known issues:

• It requires tpope’s vim-fugitive plugin to work.
• It only works with unstaged diffs – it would be nice to be able to pass an arbitrary range of commits and see the diffs between them.

Both of the above could be resolved by writing a little script to open all the diffs in vim rather than using fugitive’s :Gdiff command, but for now this little alias does the job nicely.

Tagged with: alias, git, vim