dotfiles

*nix config files
git clone git://git.pyratebeard.net/dotfiles.git
Log | Files | Refs | README

commit 618dfead306fc71c6e4692b8580ceabfb4fec74a
parent 654590150871dc45e94bc5894e85acfb5594e6f7
Author: pyratebeard <root@pyratebeard.net>
Date:   Thu, 25 Feb 2021 16:59:38 +0000

live edit md file in vim while viewing as pdf in zathura

Diffstat:
Abin/bin/mdpdf | 31+++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+), 0 deletions(-)

diff --git a/bin/bin/mdpdf b/bin/bin/mdpdf @@ -0,0 +1,31 @@ +#!/bin/sh +# dependencies: +# - pandoc +# - wkhtmltopdf engine +# - zathura +# - vim + +if [ -z $1 ] ; then + echo -e "no file" + exit 1 +fi + +md="${1}" +pdf=$( basename "${md}" .md)".pdf" + +if [ ! -f "${pdf}" ] ; then + pandoc "${md}" \ + -f markdown \ + -t html5 \ + -o "${pdf}" 2>/dev/null +fi + +zathura "${pdf}" & +zpid=$! + +vim -c "autocmd BufWritePost *.md silent! \ +!pandoc % -o %:r.pdf \ +--pdf-engine=wkhtmltopdf \ +2>/dev/null" "${md}" + +kill ${zpid}