# Using Vim Latex-live-preview with minted package

I was wondering if anyone had succeeded to make vim-live-preview with the package minted.

When I tried to edit the pdflatex command winthin the script.vim by adding the -escape-shell switch, but here's the output for :

(for real fullsize picture: http://i.stack.imgur.com/EKaC2.png)

However when I use the following command (manually in a shell) it works fine:

pdflatex -shell-escape myfile


I was wondering if it didn't work because minted uses external stuff to work, therefore the live processing can't happen.

Is this an output generated by a badly installed minted or just something else?

For those interested in knowing more about the vim plugin, this is where I downloaded it: Vim Latex-Live-Preview

edit:

Here's the .log of the failure (I've only put the interesting stuff)

! Package minted Error: You must invoke LaTeX with the -shell-escape flag.

See the minted package documentation for explanation.
Type  H <return>  for immediate help.


...

l.3 \begin
{document}
Pass the -shell-escape flag to LaTeX. Refer to the minted.sty documentation for

runsystem(which pygmentize && touch tp2.aex)...disabled.


...

! Package minted Error: You must have pygmentize' installed to use this packag
e.

runsystem(pygmentize -S default -f latex > tp2.pyg)...disabled.

(/tmp/tmpI8agTH/tp2.pyg)
\openout3 = tp2.pyg'.

runsystem(pygmentize -l c -f latex -F tokenmerge             -P "verboptions= "
-o tp2.out.pyg tp2.pyg)...disabled.

! LaTeX Error: File tp2.out.pyg' not found.


...

l.9 \end{minted}^^M

*** (cannot \read from terminal in nonstop modes)

-
Does minted work if you try the same command as in vim-latex-live-preview: pdflatex -shell-escape -interaction=no -output-dir=/tmp filename? Do you get any error message in the log file (which should be in a random directory created by mktempdir() in the plugin ). –  Aditya Nov 9 '12 at 6:40
Yes it does. Clean output. I don't know where to get the log though (for the compile that generates crap) –  Pacane Nov 9 '12 at 7:09
You can change the value of 'tmp_dir' in vim-latex-live-preview to a fixed directory, and then look at the log file there. –  Aditya Nov 9 '12 at 8:43
I've been able to change the directory (I don't know too much about the programming language it's scripted with), but I've figured out how to get into the out folder. So I updated my question with the important bits of the logs. –  Pacane Nov 9 '12 at 9:12

There are two steps to accomplish this on Gnu/Linux (Ubuntu):

1. In your .vimrc add the line

let g:Tex_DefaultTargetFormat='pdf'

(for some reason changing the default in my texrc did not work, but the above does)

2. In your texrc file (inside .vim/ftplugin.latex-suite) go to the Compiler rules section. There you make sure that the following line:

TexLet g:Tex_CompileRule_pdf = 'pdflatex -interaction=nonstopmode $*' is changed to: TexLet g:Tex_CompileRule_pdf = 'pdflatex -shell-escape -interaction=nonstopmode$*'`

Restart your (g)vim (so that all the settings are read again) and now the compilation should work with all minted items.

Note: As I post the answer I realize that I have never tested this with live preview, simply because I do not use that. I keep the pdf open in evince and that updates automatically every time I recompile.

-