bin/b: improve bat integration

This commit is contained in:
xeruf 2021-12-14 14:45:30 +01:00
parent 80631fa2f9
commit 1a29bcb1be
2 changed files with 3 additions and 3 deletions

View File

@ -124,8 +124,8 @@ if test "$bat" -o "$batl"; then
test "$(bat --version | cut -d. -f2)" -gt 16 && rule=,rule
if test $# -gt ${#bat[@]} -a $# -gt ${#batl[@]} && test -z "$args"
then $elevate head "${batl[@]}" "${bat[@]}" | cut -c-$(echo "$(tput cols)*1.9" | bc | cut -d. -f1)
else test "$bat" && $elevate bat --style header$rule --pager 'less -RF' $args "${bat[@]}"
test "$batl" && $elevate bat --style ${rule#,} --pager 'less -RF' $args "${batl[@]}"
else test "$bat" && $elevate bat --style numbers,header$rule --pager 'less -RF' $args "${bat[@]}"
test "$batl" && $elevate bat --style plain$rule --pager 'less -RF' $args "${batl[@]}"
fi
fileinfo "${bat[@]}"
fi

View File

@ -9,7 +9,7 @@ case $1 in
info --vi-keys "$(test "$last" != zsh && echo "--index-search=$last")" zsh ||
LESS="$LESS +/^ *$last *\\[" man zshall;;
(vlc) unbuffer vlc --full-help "${@:2}" | $paginate;;
(gh|chordpro) "$@" --help | $paginate;;
(gh|chordpro|bat) unbuffer "$@" --help | $paginate;;
(caddy|stretchly|go) "$1" help "${@:2}" | $paginate;;
(*) man "$@" ||
{ info "$1" -w | grep -v "manpages" && pinfo "$@"; } ||