vimdiff but each file on a different tab
Go to file
Balakrishnan Balasubramanian 32e186695a Keep new changes on right
Saves and restores splitright option
Backported from 512df2948
2023-03-06 10:53:14 -05:00
LICENSE Add README and LICENSE 2022-12-07 18:04:27 -05:00
README.md Add README and LICENSE 2022-12-07 18:04:27 -05:00
vimtabdiff.py Keep new changes on right 2023-03-06 10:53:14 -05:00

Usage

    usage: vimtabdiff.py [-h] [--vim VIM] pathA pathB

    Show diff of files from two directories in vim tabs

    positional arguments:
      pathA
      pathB

    options:
      -h, --help  show this help message and exit
      --vim VIM   vim command to run

Git difftool

Setup

    git config --global difftool.vimtabdiff.cmd 'vimtabdiff.py $LOCAL $REMOTE'
    git config --global alias.dt 'difftool --tool vimtabdiff --dir-diff'

Usage

    git dt <any git diff revision expression> # see `man gitrevisions`
    git dt           # Unstaged changes
    git dt --staged  # Staged changes
    git dt HEAD~1    # Last commit
    git di v1.0 v2.0 # diff between two tags

Using custom vim command

    git config --global difftool.vimtabdiff.cmd 'vimtabdiff.py --vim "vim --clean" $LOCAL $REMOTE'

Git config file (~/.gitconfig) should look like this

    [alias]
            ...
            dt = difftool --tool vimtabdiff --dir-diff
    [difftool "vimtabdiff"]
            cmd = vimtabdiff.py --vim \"vim --clean\" $LOCAL $REMOTE

Known issues

  1. If your path to custom vim has space, it does not work. i.e. Following does not work

    git config --global difftool.vimtabdiff.cmd 'vimtabdiff.py --vim "/home/foo/my files/bin/vim" $LOCAL $REMOTE'
    
  2. Not tested in non-linux OS. Pull requests welcome if found any issues.

Similar

https://gist.github.com/Osse/4709787