mirror of
https://github.com/ItsDrike/dotfiles.git
synced 2024-11-10 02:39:40 +00:00
Wrap bat previews to preview window width
This commit is contained in:
parent
7159661eea
commit
119b6562e2
|
@ -122,7 +122,9 @@ text_handle() {
|
||||||
# Handle all other formats as text and cat them
|
# Handle all other formats as text and cat them
|
||||||
# if highlighting tools are aviable, try to use them
|
# if highlighting tools are aviable, try to use them
|
||||||
if command -v bat > /dev/null; then
|
if command -v bat > /dev/null; then
|
||||||
bat -pp --color=always "$1"
|
num=$(printf "%0.f\n" "`echo "$(tput cols) / 2" | bc`")
|
||||||
|
numb=$(printf "%d\n" "`echo "$(tput cols) - $num - 3" | bc`")
|
||||||
|
bat -pp --color=always --wrap=character --terminal-width="$numb" "$1"
|
||||||
elif command -v highlight > /dev/null; then
|
elif command -v highlight > /dev/null; then
|
||||||
highlight "$1" --out-format ansi --force
|
highlight "$1" --out-format ansi --force
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue