# Set up vim with latex-suite to use latexmk

Today I started using vim in combination with the latex-suite plugin, and so far I love it. Other editors also make using LaTeX easier by providing code completed and such, but latex-suites's versatility seems unmatched.

The only issue that I have so far is that I want to keep using my latexmk setup. At the moment, I store a .latexmkrc file in my working directory, and run latexmk --pdf --pvc file.tex from a terminal.

How can I combine latexmk and latex-suite such that I can keep using latex-suite's useful set-up with the error windows at the bottom? Here is a screenshot to clarify which "error window" I mean:

I have updated my vimrc according to Aditya's proposal. Here is the relevant part:

filetype plugin on
set grepprg=grep\ -nH\ $* filetype indent on let g:tex_flavor='latex' let g:Tex_DefaultTargetFormat = 'pdf' let g:Tex_CompileRule_pdf = 'latexmk -pdf -pvc$*'
set iskeyword+=:


When pressing \ll now, nothing happens at all.

Any thoughts would be greatly appreciated!

-
See :he latex-compiling and :he compiler-rules. I guess that setting g:TeX_CompileRule_pdf = 'latexmk -pdf -pvc $*' should work (assuming that -pvc sets interactionmode=nonstop behind the scenes. – Aditya Oct 23 '11 at 18:24 Thanks Aditya, I have played around with your proposal recently but couldn't get it to work - strangely! It would be great if you could also check my updated question. – Ingo Oct 25 '11 at 19:57 Btw. in your comment it must be g:Tex_CompileRule_pdf .... with a small x. Almost drove me crazy until I found that out ;-). – Ingo Oct 25 '11 at 20:07 Not directly answer your question. You may consider latex-box (vim.org/scripts/script.php?script_id=3109) and snipMate (vim.org/scripts/script.php?script_id=2540). Latex-box use latexmk for compilation and provides omni-completion for citations, reference. Also it is easy to get it work with user defined non-standard citation commands like biblatex's. as well as reference commands. snipMate, which emulate the snip concept in TextMate, is the best way I know for code completion. latex-box is lightweight, unlike latex-suite's versatility. But they just work. – Yan Zhou Oct 25 '11 at 20:36 Might it be possible to get only the macros of latex-suite working, but using latex-box for compiling? So that I ]could still use things like  a  giving \alpha, but latex-box would do the rest? – Ingo Oct 26 '11 at 5:50 ## 2 Answers The following works on my end: Create a file called latexmk.vimrc in the current directory with the following content set nocompatible filetype plugin on set grepprg=grep\ -nH\$*
filetype indent on
let g:tex_flavor='latex'

let g:Tex_DefaultTargetFormat = 'pdf'
let g:Tex_CompileRule_pdf = 'latexmk -pdf -f \$*'
set iskeyword+=:


Call vim -u latexmk.vimrc filename where filename is a tex file. Type \ll in normal mode runs latexmk. I need to press enter at the end but I don't know how to get rid of that.

-
Still can not get this to work. I'll give AutomaticLaTeXPlugin a shot now and see how that works, it uses LaTeXBox in the background which natively applies latexmk. – Ingo Oct 27 '11 at 17:03
@tehingo: Did you try the method exactly (using -u latexmf.vimrc, which does not load any local settings). If you use gvim, add -U NONE so that the settings from .gvimrc` are not loaded. – Aditya Oct 27 '11 at 17:27

There two plugins which support latexmk within vim:

LatexBox

and

AutomaticTexPlugin

The last one has also built-in method to compile documents in the background (live updates) and shows a progress bar. It also has a very good completion, see the feature list.

-
If this is a product of yours, please disclose it, see the faq. – doncherry Nov 24 '12 at 16:55