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 test "$(bat --version | cut -d. -f2)" -gt 16 && rule=,rule
if test $# -gt ${#bat[@]} -a $# -gt ${#batl[@]} && test -z "$args" 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) 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[@]}" else test "$bat" && $elevate bat --style numbers,header$rule --pager 'less -RF' $args "${bat[@]}"
test "$batl" && $elevate bat --style ${rule#,} --pager 'less -RF' $args "${batl[@]}" test "$batl" && $elevate bat --style plain$rule --pager 'less -RF' $args "${batl[@]}"
fi fi
fileinfo "${bat[@]}" fileinfo "${bat[@]}"
fi fi

View File

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