Add colorized output to files command

This commit is contained in:
samedamci 2021-09-01 00:16:58 +02:00
parent 80ee840fa0
commit 4d19b1b8a9
No known key found for this signature in database
GPG Key ID: FCB4A9A20D00E894

View File

@ -2,10 +2,11 @@
[ "$1" ] && commit_hash="$1" || commit_hash="HEAD"
commit="git --no-pager show -q $commit_hash"
limiter="seq -s_ 150|tr -d '[:digit:]'"
commit="git --no-pager log --color=always -n 1 $commit_hash"
delimiter="seq -s_ 150 | tr -d '[:digit:]'"
file_content="git show $commit_hash:{}"
pager="bat --style numbers --decorations always --file-name {}"
git ls-tree -r --name-only "$commit_hash" |
fzf --ansi --preview "$commit && $limiter && $file_content" \
fzf --ansi --preview "$commit && $delimiter && $file_content | $pager" \
--preview-window=right:70%