diff options
author | Mathias Bynens <mathias@qiwi.be> | 2012-03-23 13:01:33 +0100 |
---|---|---|
committer | Mathias Bynens <mathias@qiwi.be> | 2012-03-23 13:01:33 +0100 |
commit | c93d1134cc9bffdd872eb2a28368ef44ac01a326 (patch) | |
tree | a809db9fe9a810870635e7f9cb971d6a5a1e491f | |
parent | 90e36ca1e0975f931a74fff70091a652995b98ed (diff) | |
download | dotfiles-c93d1134cc9bffdd872eb2a28368ef44ac01a326.tar.gz dotfiles-c93d1134cc9bffdd872eb2a28368ef44ac01a326.tar.bz2 dotfiles-c93d1134cc9bffdd872eb2a28368ef44ac01a326.zip |
.functions: Alias `diff` to `git diff` when available
-rw-r--r-- | .functions | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -3,6 +3,14 @@ function md() { mkdir -p "$@" && cd "$@" } +# Use Git’s colored diff when available +hash git &>/dev/null +if [ $? -eq 0 ]; then + function diff() { + git diff --no-index --color-words "$@" + } +fi + # Create a data URL from an image (works for other file types too, if you tweak the Content-Type afterwards) dataurl() { echo "data:image/${1##*.};base64,$(openssl base64 -in "$1")" | tr -d '\n' |