ctpv/prev/text.sh
Nikita Ivanov 8487750f1a
Many additions and improvements
Basic previews, priority setting, better -m option
2022-05-23 23:45:35 +05:00

25 lines
620 B
Bash

if exists bat; then
batcmd=bat
elif exists batcat; then
batcmd=batcat
else
batcmd=
fi
if [ -n "$batcmd" ]; then
"$batcmd" --color always \
--style plain \
--paging never \
--terminal-width "$w" \
--wrap character \
-- "$f"
elif exists highlight; then
highlight --replace-tabs=4 --out-format=ansi \
--style='pablo' --force -- "$f"
elif exists source-highlight; then
source-highlight --tab=4 --out-format=esc \
--style=esc256.style --failsafe -i "$f"
else
cat "$f"
fi