Re:Writing a Book with Pandoc, Make, and Vim
by JoshMcguigan on Monday April 13, 2020 @08:24AM
(#22855201)
The pipeline approach here is interesting, but it seems you'd be on your own for filtering out changes in the build directory, etc. I typically use watchexec [1] for this.
watchexec make
By default, watchexec will filter out changes in files based on `.gitignore`.This is pretty good, didn't know about watchexec, but you can achieve the same by choosing carefully the command you pipe from, for example:
ls *.md | make
Will only trigger the build if a md file is modified, which is what I think the author is interested in.I personally use fswatch for this. The invocation is probably something like this:
fswatch -0 ***.md | xargs -0 make
I invoke a variant of this from my Makefile with a phony watch target. I think the main change is that I also echo a bell character, to provide some feedback.Fun tip: Preview will automatically reload PDFs on disk, though with some limitations that I workaround by waiting for the bell.
[1]: http://eradman.com/entrproject/