Last active
September 22, 2018 23:04
-
-
Save kdart/293b74f8b55b3aca589a5bb06209a852 to your computer and use it in GitHub Desktop.
Use [g]vimdiff as the diff tool in git.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# shell wrapper to use gvimdiff and vimdiff as git differ. | |
# set up your ~/.gitconfig like this to use it: | |
#[diff] | |
# external = gitdiff.sh | |
# | |
#[pager] | |
# diff = | |
# ndiff = less | |
# | |
#[alias] | |
# ndiff = diff --no-ext-diff | |
# The ndiff alias is the "normal diff" in case you don't want to use vimdiff some times. | |
# This will use gvimdiff in a graphical environment (DISPLAY is set), or run an | |
# in-terminal vimdiff if not. | |
# Also, put this in your ~/.vimn/vimrc file to make exiting quicker. | |
# | |
# if &diff | |
# nmap ZZ :qall<CR> | |
# endif | |
if [ -n "$DISPLAY" ] ; then | |
DIFF="/usr/local/bin/gvimdiff -RMmf" | |
else | |
DIFF="/usr/local/bin/vimdiff -RMm" | |
fi | |
LEFT=${2} | |
RIGHT=${5} | |
exec $DIFF "$LEFT" "$RIGHT" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment