git: Make git diff termcolor aware
Added simple light/dark distinction for git diffs using delta. Will use the TERM_DARK env variable which is set in the base module functionality on opening a new term. This means unfortunately git diffs will have the wrong color when terms recently changed between light-dark but on opening a new one the error is gone and it automatically adapts again to the terminal background color.
This commit is contained in:
parent
62ec2799c8
commit
b6687145bd
2 changed files with 14 additions and 11 deletions
|
@ -5,11 +5,11 @@
|
||||||
[init]
|
[init]
|
||||||
defaultBranch = main
|
defaultBranch = main
|
||||||
[core]
|
[core]
|
||||||
pager = delta
|
pager = git delta
|
||||||
[pager]
|
[pager]
|
||||||
difftool = true
|
difftool = true
|
||||||
[interactive]
|
[interactive]
|
||||||
diffFilter = delta --color-only
|
diffFilter = git delta --color-only
|
||||||
[merge]
|
[merge]
|
||||||
conflictstyle = diff3
|
conflictstyle = diff3
|
||||||
[delta]
|
[delta]
|
||||||
|
@ -27,6 +27,7 @@
|
||||||
diffword = "!git diff --word-diff=color --word-diff-regex='[0-9A-Za-z_]+'" # word-wise diff, good for prose
|
diffword = "!git diff --word-diff=color --word-diff-regex='[0-9A-Za-z_]+'" # word-wise diff, good for prose
|
||||||
diffsyn = "!git difftool --tool difftastic" # add syntax-driven diff using treesitter
|
diffsyn = "!git difftool --tool difftastic" # add syntax-driven diff using treesitter
|
||||||
diffside = "!DELTA_FEATURES='+side-by-side' git diff" # add side-by-side diffing
|
diffside = "!DELTA_FEATURES='+side-by-side' git diff" # add side-by-side diffing
|
||||||
|
delta = "![ $TERM_DARK=false ] && delta --light || delta" # Take care that we always display right color scheme
|
||||||
[commit]
|
[commit]
|
||||||
gpgsign = true # sign commits as me
|
gpgsign = true # sign commits as me
|
||||||
verbose = true # Always show diff when preparing commit message
|
verbose = true # Always show diff when preparing commit message
|
||||||
|
|
|
@ -31,13 +31,11 @@ else
|
||||||
fi
|
fi
|
||||||
alias gco='git checkout'
|
alias gco='git checkout'
|
||||||
|
|
||||||
alias gd='git diff'
|
|
||||||
alias gdd='git diffword'
|
|
||||||
alias gds='git diff --staged'
|
|
||||||
alias gdds='git diffword --staged'
|
|
||||||
|
|
||||||
alias gi='git ignore'
|
alias gi='git ignore'
|
||||||
|
|
||||||
|
# normal diff
|
||||||
|
alias gd='git diff'
|
||||||
|
alias gds='git diff --staged'
|
||||||
# word-based diff (with custom word regex)
|
# word-based diff (with custom word regex)
|
||||||
alias gdw='git diffword'
|
alias gdw='git diffword'
|
||||||
alias gdws='git diffword --staged'
|
alias gdws='git diffword --staged'
|
||||||
|
@ -49,12 +47,16 @@ if exist difft; then
|
||||||
alias gdy='git diffsyn'
|
alias gdy='git diffsyn'
|
||||||
alias gdys='git diffsyn --staged'
|
alias gdys='git diffsyn --staged'
|
||||||
fi
|
fi
|
||||||
|
alias gdd='git diffside'
|
||||||
|
alias gdds='git diffside --staged'
|
||||||
# show last committed content
|
# show last committed content
|
||||||
alias gdl='git last'
|
alias gdl='git last'
|
||||||
|
|
||||||
# show quick log overview
|
# show quick log overview
|
||||||
alias glg='git log --oneline --decorate --graph'
|
alias glg='git log --oneline --decorate --graph'
|
||||||
alias glgd="git log --graph --pretty=format:'%C(auto)%h%Creset %C(cyan)%ar%Creset%C(auto)%d%Creset %s'"
|
|
||||||
alias glga='git log --oneline --decorate --graph --remotes --all'
|
alias glga='git log --oneline --decorate --graph --remotes --all'
|
||||||
|
# show quick log overview - with dates
|
||||||
|
alias glgd="git log --graph --pretty=format:'%C(auto)%h%Creset %C(cyan)%ar%Creset%C(auto)%d%Creset %s'"
|
||||||
alias glgad="git log --graph --remotes --all --pretty=format:'%C(auto)%h%Creset %C(cyan)%ar%Creset%C(auto)%d%Creset %s'"
|
alias glgad="git log --graph --remotes --all --pretty=format:'%C(auto)%h%Creset %C(cyan)%ar%Creset%C(auto)%d%Creset %s'"
|
||||||
# show detailed log overview
|
# show detailed log overview
|
||||||
alias glog='git log --stat'
|
alias glog='git log --stat'
|
||||||
|
|
Loading…
Reference in a new issue