Use delta as git diff pager

This commit is contained in:
coolneng 2022-09-04 07:16:17 +02:00
parent bff17eb884
commit b37187f79e
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
4 changed files with 26 additions and 0 deletions

View File

@ -4,6 +4,7 @@
signingkey = 9893DA236405AF57 signingkey = 9893DA236405AF57
[core] [core]
excludesfile = /home/coolneng/.config/git/global_gitignore excludesfile = /home/coolneng/.config/git/global_gitignore
pager = delta
[credential] [credential]
helper = !pass-git-helper $@ helper = !pass-git-helper $@
[commit] [commit]
@ -17,3 +18,17 @@
[filter "git-ignore-line.sh"] [filter "git-ignore-line.sh"]
clean = git-ignore-line.sh clean = git-ignore-line.sh
smudge = cat smudge = cat
[interactive]
diffFilter = delta --color-only
[add.interactive]
useBuiltin = false # required for git 2.37.0
[delta]
navigate = true # use n and N to move between diff sections
# GITIGNORE START
light = false # set to true if you're in a terminal w/ a light background color (e.g. the default macOS terminal)
syntax-theme = Nord
# GITIGNORE END
[merge]
conflictstyle = diff3
[diff]
colorMoved = default

View File

@ -992,3 +992,4 @@ map kitty_mod+delete clear_terminal reset active
confirm_os_window_close 0 confirm_os_window_close 0

View File

@ -5,11 +5,20 @@ capitalize() {
printf '%s' "$1" | tail -c '+2' printf '%s' "$1" | tail -c '+2'
} }
modify_delta() {
if [ "$1" = "light" ]; then
sed -e "s/light = false/light = true/" -e "s/Nord/OneHalfLight/" -i ~/.config/git/config
else
sed -e "s/light = true/light = false/" -e "s/OneHalfLight/Nord/" -i ~/.config/git/config
fi
}
change_theme() { change_theme() {
sed -i "s/iceberg_$1/iceberg_$2/" ~/.config/kitty/kitty.conf sed -i "s/iceberg_$1/iceberg_$2/" ~/.config/kitty/kitty.conf
sed -i "s/bg=$1/bg=$2/" ~/.config/nvim/init.vim sed -i "s/bg=$1/bg=$2/" ~/.config/nvim/init.vim
sed -i "s/iceberg_$1/iceberg_$2/" ~/.dotfiles/tmux/.tmux.conf sed -i "s/iceberg_$1/iceberg_$2/" ~/.dotfiles/tmux/.tmux.conf
sed -i "s/iceberg_$1/iceberg_$2/" ~/.config/zathura/zathurarc sed -i "s/iceberg_$1/iceberg_$2/" ~/.config/zathura/zathurarc
modify_delta "$2"
kitty +kitten themes --reload-in=all "Iceberg $(capitalize "$2")" kitty +kitten themes --reload-in=all "Iceberg $(capitalize "$2")"
tmux source-file ~/.tmux.conf tmux source-file ~/.tmux.conf
nvr --remote-send ":source ~/.config/nvim/init.vim <CR> :set nonumber <CR> :set norelativenumber <CR>" nvr --remote-send ":source ~/.config/nvim/init.vim <CR> :set nonumber <CR> :set norelativenumber <CR>"

View File

@ -78,3 +78,4 @@ set -g mouse on
bind -T root WheelUpPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; copy-mode -e; send-keys -M" bind -T root WheelUpPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; copy-mode -e; send-keys -M"
bind -T root WheelDownPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; send-keys -M" bind -T root WheelDownPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; send-keys -M"
# Colorscheme file