[Tex/LaTex] Set up vim with latex-suite to use latexmk

latexmkvimvim-latex

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:

vim with latex-suite, error window


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!

Best Answer

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.