I am the author of the ConTeXt module t-vim
which is similar to minted
but uses vim
rather than pygmentize
to generate syntax highlighting. The t-vim
module actually delegates the task of running external programs to t-filter
module, which is provides the necessary pluming to call external programs on the content of an environment.
By default, the t-filter
module behaves in the same manner as minted
package: it writes the contents of the environment to an external file, calls the external program, and inputs the result back to TeX. However, to deal with slow external program, the filter module provides a continue=yes
option. When this option is enabled, the content of each file is written to a separate file and the md5 sum of each file is calculated. The external filter is run only if the md5 sum is changed.
In MkII, this feature is enabled by calling the external program using
\doifmode{*first}
{\executeexternalcommand{mtxrun --ifchanged=\inputfile \externalprogram}}
This calls mtxrun
, the wrapper script for ConTeXt, which calculates the md5 sum of the file (and stores it as filename.md5
) and the the program only if the md5 sum is stored. This is faster than running vim
, but still slow as a new process (mtxrun
) must be executed. To speed things up, I wrap the entire command in a \doifmode{*first}
so that mtxrun
is called only during the first run of a multi-run compilation.
To speed up things further, in MkIV, I use the ConTeXt lua function job.files.run
, which stores the md5 in the tuc
file (similar to aux
file in LaTeX). So the call to the external program is roughly equal to
\ctxlua{job.files.run("\inputfile", "\externalprogram")}
The same method can, in principle, be implemented in minted
. In fact, the mtxrun --ifchanged
method can be incorporated easily, provided that minted writes each environment in a separate file (currently it does not do that).
t-vim
(which is likeminted
but uses vim editor rather than pygments, though I might support pygments in the future), I create a md5 sum of each external file, and re-run vim only if the external file has changed. Perhaps you can use the same approach inminted
. Instead of callingpygmentize --options
callmtxrun --ifchanged <filename> --direct pygmentize --options
, andmtxrun
will do all the book keeping.minted.sty
file. Perhaps I'll make a request to Konrad Rudolph that he implement this as an option in the next minted version.