vifm: Fancy markdown display with glow or bat

For anything markdown or that gets displayed as markdown
(e.g. docx files) in the vifm preview, we now use glow
or bat to display a nicely styled and colored version.

For glow I added a script which tries to detect the
current terminal background between dark/light to
correctly set the color scheme.
This commit is contained in:
Marty Oehme 2023-10-03 12:59:07 +02:00
parent 893c177358
commit 7ccd7e4757
Signed by: Marty
GPG key ID: EDBF2ED917B2EF6A
4 changed files with 82 additions and 2 deletions

View file

@ -552,7 +552,8 @@ filetype *.docx
\ pandoc -s -t markdown %f | nvim,
\ docx2txt %f - | nvim
fileviewer *.docx
\ pandoc -s -t markdown %f,
\ [ "$TERM_DARK" = "true" ] && pandoc -s -t markdown %f | glow --style=dark - || pandoc -s -t markdown %f | glow --style=light -,
\ pandoc -s -t markdown %f | bat --color=always --style=plain
\ docx2txt %f -
" TuDu files
@ -569,6 +570,11 @@ fileviewer */
\ exa --color always --tree -L2,
\ tree -L 2,
" markdown text
fileviewer *.md
\ [ "$TERM_DARK" = "true" ] && glow --style=dark %c || glow --style=light %c,
\ bat --color=always --style=plain
" use custom viewer script for rest
fileviewer * vifm-default-viewer %c