1
0
mirror of https://github.com/frebib/dotfiles.git synced 2024-06-14 12:57:23 +00:00

git/config: improve git-diff colours with diff-so-fancy

This commit is contained in:
Joe Groocock 2018-03-29 15:57:51 +01:00
parent f288397231
commit 593f39fff3
Signed by: frebib
GPG Key ID: E0B16BEACFBB6A86
4 changed files with 32 additions and 15 deletions

View File

@ -4,7 +4,8 @@
signingkey = CFBB6A86 signingkey = CFBB6A86
[core] [core]
autocrlf = input autocrlf = input
excludesfile = /home/frebib/.config/git/gitignore excludesfile = $HOME/.config/git/gitignore
pager = diff-so-fancy | less
[commit] [commit]
gpgsign = true gpgsign = true
[push] [push]
@ -13,8 +14,6 @@
rebase = true rebase = true
[rebase] [rebase]
autoStash = true autoStash = true
[color]
ui = auto
[log] [log]
date = relative date = relative
[format] [format]
@ -27,8 +26,6 @@
[advice] [advice]
statusHints = false statusHints = false
pushUpdateRejected = false pushUpdateRejected = false
[diff]
algorithm = patience
[sendemail] [sendemail]
from = Joe Groocock <me@frebib.net> from = Joe Groocock <me@frebib.net>
smtpserver = smtp.zoho.com smtpserver = smtp.zoho.com
@ -36,3 +33,25 @@
smtpencryption = ssl smtpencryption = ssl
smtpserverport = 465 smtpserverport = 465
suppresscc = self suppresscc = self
[diff]
algorithm = patience
[interactive]
diffFilter = diff-so-fancy --patch-mode
[color]
ui = true
[color "diff"]
meta = cyan
frag = magenta
commit = yellow
old = red
new = green
whitespace = red 88 reverse
[color "diff-highlight"]
oldNormal = red
oldHighlight = red 88
newNormal = green
newHighlight = green 22
[diff-so-fancy]
changeHunkIndicators = false
# vim: noet

View File

@ -22,7 +22,7 @@ highlight = #5294E2
# Normal colours # Normal colours
color0 = #333638 color0 = #333638
color1 = #ff3f00 color1 = #f41f1c
color2 = #8bc34a color2 = #8bc34a
color3 = #ffc107 color3 = #ffc107
color4 = #0266f4 color4 = #0266f4
@ -32,7 +32,7 @@ color7 = #8b9396
# Bright colours # Bright colours
color8 = #475760 color8 = #475760
color9 = #ef5345 color9 = #e53727
color10 = #9ccc65 color10 = #9ccc65
color11 = #ffa000 color11 = #ffa000
color12 = #81b3f9 color12 = #81b3f9

View File

@ -29,7 +29,7 @@ export GOPATH="$HOME/.cache/go"
exists() { which $@ 0<&- 1>/dev/null 2>/dev/null; } exists() { which $@ 0<&- 1>/dev/null 2>/dev/null; }
export LESS="-RNI" export LESS="-RI"
export PAGER="less $LESS" export PAGER="less $LESS"
if exists tput; then if exists tput; then
export LESS_TERMCAP_mb=$(tput bold; tput setaf 2) # green export LESS_TERMCAP_mb=$(tput bold; tput setaf 2) # green

12
aliases
View File

@ -92,7 +92,6 @@ alias -s gz="tar tf"
alias -s jar="java -jar" alias -s jar="java -jar"
alias -s git="git clone --recursive" alias -s git="git clone --recursive"
# Git Aliases # Git Aliases
alias g=git alias g=git
alias gignore='$EDITOR .gitignore' alias gignore='$EDITOR .gitignore'
@ -102,7 +101,7 @@ alias gcl="git clone --recursive"
alias gco="git checkout" alias gco="git checkout"
alias gcom="git checkout master" alias gcom="git checkout master"
alias ga="git add" alias ga="git add"
alias gap="git -c interactive.diffFilter=\"git diff --color-words\" add -p" alias gap="git add -p"
alias gaa="ga -A" alias gaa="ga -A"
alias grm="git rm" alias grm="git rm"
alias gc="git commit" alias gc="git commit"
@ -130,14 +129,13 @@ alias glp="gl && gp"
gd() { gd() {
local commit=$1 local commit=$1
if [ -z "$commit" ] || [ ${commit:0:1} != '@' ]; then if [ -z "$commit" ] || [ ${commit:0:1} != '@' ]; then
git diff --color-words $@ git diff $@
return
else else
git diff --color-words "@~${commit:1}^!" git diff "@~${commit:1}^!"
fi fi
} }
alias gds="git diff --staged --color-words" alias gds="git diff --staged"
alias gsh="git show --color-words" alias gsh="git show"
alias glg="git log --stat --color" alias glg="git log --stat --color"
alias glog="git log --oneline --decorate --color --graph" alias glog="git log --oneline --decorate --color --graph"