Improve git config
* use functions for activation * add support for delta
This commit is contained in:
@@ -46,7 +46,53 @@ function can_run() {
|
|||||||
command -v "$application" > /dev/null
|
command -v "$application" > /dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
git config --global core.editor vim
|
function activate_delta() {
|
||||||
|
git_set core.pager delta
|
||||||
|
git_set interactive.diffFilter "delta --color-only"
|
||||||
|
git_set delta.navigate true
|
||||||
|
git_set delta.side-by-side false
|
||||||
|
git_set merge.conflictstyle diff3
|
||||||
|
git_set diff.colorMoved default
|
||||||
|
}
|
||||||
|
|
||||||
|
function activate_diff_so_fancy() {
|
||||||
|
git_set core.pager "diff-so-fancy | less --tabs=4 -RFX"
|
||||||
|
git_set interactive.diffFilter "diff-so-fancy --patch"
|
||||||
|
}
|
||||||
|
|
||||||
|
function set_colors() {
|
||||||
|
git_set color.ui true
|
||||||
|
|
||||||
|
git_set color.diff-highlight.oldNormal "red bold"
|
||||||
|
git_set color.diff-highlight.oldHighlight "red bold 52"
|
||||||
|
git_set color.diff-highlight.newNormal "green bold"
|
||||||
|
git_set color.diff-highlight.newHighlight "green bold 22"
|
||||||
|
|
||||||
|
git_set color.diff.meta "11"
|
||||||
|
git_set color.diff.frag "magenta bold"
|
||||||
|
git_set color.diff.func "146 bold"
|
||||||
|
git_set color.diff.commit "yellow bold"
|
||||||
|
git_set color.diff.old "red bold"
|
||||||
|
git_set color.diff.new "green bold"
|
||||||
|
git_set color.diff.whitespace "red reverse"
|
||||||
|
}
|
||||||
|
|
||||||
|
function unset_colors() {
|
||||||
|
git_unset color.diff-highlight.oldNormal
|
||||||
|
git_unset color.diff-highlight.oldHighlight
|
||||||
|
git_unset color.diff-highlight.newNormal
|
||||||
|
git_unset color.diff-highlight.newHighlight
|
||||||
|
|
||||||
|
git_unset color.diff.meta
|
||||||
|
git_unset color.diff.frag
|
||||||
|
git_unset color.diff.func
|
||||||
|
git_unset color.diff.commit
|
||||||
|
git_unset color.diff.old
|
||||||
|
git_unset color.diff.new
|
||||||
|
git_unset color.diff.whitespace
|
||||||
|
}
|
||||||
|
|
||||||
|
git_set core.editor vim
|
||||||
|
|
||||||
git_alias st status
|
git_alias st status
|
||||||
|
|
||||||
@@ -103,25 +149,11 @@ git_alias shd "stash drop"
|
|||||||
git_alias aliases "config --get-regexp alias"
|
git_alias aliases "config --get-regexp alias"
|
||||||
git_alias configs "config --list"
|
git_alias configs "config --list"
|
||||||
|
|
||||||
if can_run diff-so-fancy; then
|
#if can_run diff-so-fancy; then
|
||||||
git_set core.pager "diff-so-fancy | less --tabs=4 -RFX"
|
# activate_diff_so_fancy
|
||||||
git_set interactive.diffFilter "diff-so-fancy --patch"
|
#fi
|
||||||
|
|
||||||
git_set color.ui true
|
if can_run delta; then
|
||||||
|
echo "Activate delta"
|
||||||
git_set color.diff-highlight.oldNormal "red bold"
|
activate_delta
|
||||||
git_set color.diff-highlight.oldHighlight "red bold 52"
|
|
||||||
git_set color.diff-highlight.newNormal "green bold"
|
|
||||||
git_set color.diff-highlight.newHighlight "green bold 22"
|
|
||||||
|
|
||||||
git_set color.diff.meta "11"
|
|
||||||
git_set color.diff.frag "magenta bold"
|
|
||||||
git_set color.diff.func "146 bold"
|
|
||||||
git_set color.diff.commit "yellow bold"
|
|
||||||
git_set color.diff.old "red bold"
|
|
||||||
git_set color.diff.new "green bold"
|
|
||||||
git_set color.diff.whitespace "red reverse"
|
|
||||||
else
|
|
||||||
git_unset core.pager
|
|
||||||
git_unset interactive.diffFilter
|
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user