From f3fb0998f59ba2a303ea9238cf0bd726331ca860 Mon Sep 17 00:00:00 2001
From: Marty Oehme <marty.oehme@gmail.com>
Date: Tue, 18 Feb 2025 18:30:52 +0100
Subject: [PATCH] vifm: Replace glow with bat markdown preview

For some reason (glow 2.0.0 release?) markdown preview with glow does
_not_ work anymore within my vifm. It regresses to showing errors all
over the place instead.
---
 terminal/.config/vifm/vifmrc | 46 ++++--------------------------------
 1 file changed, 4 insertions(+), 42 deletions(-)

diff --git a/terminal/.config/vifm/vifmrc b/terminal/.config/vifm/vifmrc
index 35d133f..80e172f 100644
--- a/terminal/.config/vifm/vifmrc
+++ b/terminal/.config/vifm/vifmrc
@@ -617,9 +617,10 @@ fileviewer */
         \ tree -L 2,
 
 " markdown text
-fileviewer *.md
-        \ [ "$TERM_DARK" = "true" ] && glow --style=dark %c || glow --style=light %c,
-        \ bat --color=always --style=plain
+fileviewer *.md,*.markdown,*.mkd,*.mdx,*.rmd,*.Rmd,*.quarto,*.mdwiki
+        \ bat --color=always --style=plain --language md | less -FRX
+        " glow has ceased to work w/ version 2.0.0
+        " \ [ "$TERM_DARK" = "true" ] && glow -p --style=dark %c || glow -p --style=light %c,
 
 " use custom viewer script for rest
 fileviewer * vifm-default-viewer %c
@@ -627,45 +628,6 @@ fileviewer * vifm-default-viewer %c
 " use our own custom opener
 filetype * open
 
-" Syntax highlighting in preview
-"
-" Explicitly set highlight type for some extensions
-"
-" 256-color terminal
-" fileviewer *.[ch],*.[ch]pp highlight -O xterm256 -s dante --syntax c %c
-" fileviewer Makefile,Makefile.* highlight -O xterm256 -s dante --syntax make %c
-"
-" 16-color terminal
-" fileviewer *.c,*.h highlight -O ansi -s dante %c
-"
-" Or leave it for automatic detection
-"
-" fileviewer *[^/] pygmentize -O style=monokai -f console256 -g
-
-" Displaying pictures in terminal
-"
-" fileviewer *.jpg,*.png shellpic %c
-
-" Open all other files with default system programs (you can also remove all
-" :file[x]type commands above to ensure they don't interfere with system-wide
-" settings).  By default all unknown files are opened with 'vi[x]cmd'
-" uncommenting one of lines below will result in ignoring 'vi[x]cmd' option
-" for unknown file types.
-" For *nix:
-" filetype * xdg-open
-" For OS X:
-" filetype * open
-" For Windows:
-" filetype * start, explorer
-
-" }}}
-
-" Various customization examples
-
-" Add additional place to look for executables
-"
-" let $PATH = $HOME.'/bin/fuse:'.$PATH
-
 " Block particular shortcut
 "
 " nnoremap <left> <nop>