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:
parent
893c177358
commit
7ccd7e4757
4 changed files with 82 additions and 2 deletions
|
|
@ -21,5 +21,5 @@ charset=${info#*=}
|
|||
if [ "x$charset" == "xbinary" ]; then
|
||||
hexdump -e '"%08_ax: "' -e '8/1 "%02x " " " 8/1 "%02x "' -e '" |" 16/1 "%_p"' -e '"\n"' -v -n $nbytes "$1"
|
||||
else
|
||||
head -$nlines "$1" | enconv -g -L $language -x $encoding
|
||||
head -$nlines "$1" | enconv -g -L $language -x $encoding | bat --color=always --style=plain
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue