mirror of
https://github.com/NikitaIvanovV/ctpv.git
synced 2025-01-07 09:08:57 +01:00
Split prev/text.sh into 4 different previews
This commit is contained in:
parent
cc0b5d9342
commit
266ed12cdb
15
prev/bat.sh
Normal file
15
prev/bat.sh
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
if exists bat; then
|
||||||
|
batcmd=bat
|
||||||
|
elif exists batcat; then
|
||||||
|
batcmd=batcat
|
||||||
|
else
|
||||||
|
exit 127
|
||||||
|
fi
|
||||||
|
|
||||||
|
"$batcmd" \
|
||||||
|
--color always \
|
||||||
|
--style plain \
|
||||||
|
--paging never \
|
||||||
|
--terminal-width "$w" \
|
||||||
|
--wrap character \
|
||||||
|
-- "$f"
|
1
prev/cat.sh
Normal file
1
prev/cat.sh
Normal file
@ -0,0 +1 @@
|
|||||||
|
cat "$f"
|
3
prev/highlight.sh
Normal file
3
prev/highlight.sh
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
highlight \
|
||||||
|
--replace-tabs=4 --out-format=ansi \
|
||||||
|
--style='pablo' --force -- "$f"
|
3
prev/source_highlight.sh
Normal file
3
prev/source_highlight.sh
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
source-highlight \
|
||||||
|
--tab=4 --out-format=esc \
|
||||||
|
--style=esc256.style --failsafe -i "$f"
|
27
prev/text.sh
27
prev/text.sh
@ -1,27 +0,0 @@
|
|||||||
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
|
|
@ -15,7 +15,10 @@
|
|||||||
|
|
||||||
Preview previews[] = {
|
Preview previews[] = {
|
||||||
PP(NULL, NULL, NULL, wrapper, INT_MAX),
|
PP(NULL, NULL, NULL, wrapper, INT_MAX),
|
||||||
PR(NULL, "text", NULL, text),
|
PR(NULL, "text", NULL, bat),
|
||||||
|
PR(NULL, "text", NULL, highlight),
|
||||||
|
PR(NULL, "text", NULL, source_highlight),
|
||||||
|
PR(NULL, "text", NULL, cat),
|
||||||
PR(NULL, NULL, NULL, any),
|
PR(NULL, NULL, NULL, any),
|
||||||
PR("md", NULL, NULL, markdown),
|
PR("md", NULL, NULL, markdown),
|
||||||
PR(NULL, "application", "json", json),
|
PR(NULL, "application", "json", json),
|
||||||
|
Loading…
Reference in New Issue
Block a user