From 427ad70cd3fe05d1a7c60c4c15d559401d645c30 Mon Sep 17 00:00:00 2001 From: Michael Vorburger Date: Mon, 21 Nov 2022 23:39:14 +0100 Subject: [PATCH] alias gd with dandavison/delta Note https://github.com/dandavison/delta/issues/152 is causing a (small) change in that WS intendation is no longer ignored, but it's still possible to use git diff -w. PS: I also considered https://github.com/so-fancy/diff-so-fancy but opted for delta after reading https://dandavison.github.io/delta/features.html and seeing https://dandavison.github.io/delta/comparisons-with-other-tools.html --- dnf-install.sh | 3 ++- dotfiles/alias | 2 +- dotfiles/gitconfig | 12 ++++++++++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/dnf-install.sh b/dnf-install.sh index 362a11d..69a2f00 100755 --- a/dnf-install.sh +++ b/dnf-install.sh @@ -28,7 +28,8 @@ sudo dnf install -y \ pwgen diceware \ cargo graphviz \ google-cloud-sdk google-cloud-sdk-skaffold \ - python3-devel portaudio-devel + python3-devel portaudio-devel \ + git-delta # Do NOT add the "kubernetes-client" package above, but it causes this error: # file /usr/bin/kubectl conflicts between attempted installs of kubernetes-client-1.21.0-2.fc35.x86_64 and kubectl-1.23.0-0.x86_64 diff --git a/dotfiles/alias b/dotfiles/alias index 9ebe14f..9d5a394 100644 --- a/dotfiles/alias +++ b/dotfiles/alias @@ -19,7 +19,7 @@ alias gl="git ls" alias gll="git ll" alias glg="git lg" alias gst="git status" -alias gd="git wdiff" +alias gd="git diff" alias ga="git add" alias gc="git commit -m " alias gca="git commit --amend" diff --git a/dotfiles/gitconfig b/dotfiles/gitconfig index cacccb7..c4bd57b 100755 --- a/dotfiles/gitconfig +++ b/dotfiles/gitconfig @@ -18,7 +18,14 @@ [core] autocrlf = input eol = native - pager = less -S + pager = delta + +[interactive] + diffFilter = delta --color-only + +[delta] + navigate = true # use n and N to move between diff sections + light = false # set to true if you're in a terminal w/ a light background color (e.g. the default macOS terminal) [apply] whitespace = fix # or “warn”, but “now” leads to “fatal: unrecognized whitespace option 'now'” @@ -30,6 +37,7 @@ [diff] renames = true submodule = log + colorMoved = default [diff "zip"] textconv = unzip -c -a @@ -39,6 +47,7 @@ [merge] log = true + conflictstyle = diff3 [rerere] enabled = true @@ -61,7 +70,6 @@ ls = log --color --pretty=format:'%C(magenta)%h%Creset %C(white)%s%Creset %C(bold blue)<%aN>%Creset %C(dim blue)(%cN)%Creset%C(auto)%d%Creset' ll = log --color --format=full --compact-summary lg = log --color --graph --pretty=format:'%C(magenta)%h%Creset%C(auto)%d%Creset %s %C(bold blue)<%aN>%Creset %C(dim blue)(%cN)%Creset %C(green)(%cr)' --abbrev-commit - wdiff = diff --word-diff --word-diff-regex='\\w+' # `tig` is a useful git log TUI alternative [pull]