Last active
March 16, 2019 01:01
-
-
Save ginokent/71ee27bf35b51e2472c768562663db7d to your computer and use it in GitHub Desktop.
color diff
This file contains hidden or 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
difff() {(R=$(printf '\e[31m');G=$(printf '\e[32m');B=$(printf '\e[36m');W=$(printf '\e[1m');N=$(printf '\e[0m');diff -u "$@"|sed $(uname -s|grep -q '^Darwin'&&printf -- -E||printf -- -r) "s/(^@@.+@@|@@.+@@$)/$B\1$N/g;s/(^\+.*)$/$G\1$N/g;s/(^\-.*)$/$R\1$N/g;s/^[^\+\-]*((\+{3}|-{3}) [^ ].*)/$W\1/g;")} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment