This is a very basic question but I can't figure out how to configure MacVim (v7.3) properly to work with ConTeXt (MkIV) and Skim on Snow Leopard. Is there somebody who would kindly explain the steps that need to be taken for the setup and how to use MacVim comfortably (regarding compilation and PDF viewing and not navigation, of course)?

I am currently using TeXShop which works fine but I'd like learn about the (Mac)Vim editor too.

  • 1
    To compile you can just create a mapping or autocommand like au FileType context nnoremap <buffer> <leader><leader> :w<cr>:!context --purge "%"<cr><cr>. What else do you need?
    – Marco
    Commented May 7, 2013 at 8:03
  • 2
    Vim is just a text editor, it doesn't care what "format" the file is in. I always compile with just :!context %, no trickery needed. Also you might want to take a look of Paulo's excellent tips for vim.
    – morbusg
    Commented May 7, 2013 at 8:08
  • @morbusg Sounds like an answer to me: could you make it one?
    – Joseph Wright
    Commented Aug 15, 2013 at 19:25
  • Using :set makeprg=context --batch $* would allow you use :make to compile the file.
    – Aditya
    Commented Oct 30, 2013 at 17:40

2 Answers 2


You could use the ex-mode command to run a program, :!, and tell it to run context with the current file as input (%). That is, in full:

:!context %

This will run ConTeXt on the file, and show the compilation information in a split Vim buffer.

To open the produced PDF file in Skim, you can issue:

:!open -a Skim %:r.pdf

On consequent compilations, Skim will detect that the file has changed, and ask you if you would like to always automatically reload the rewritten document. You can then make changes to the tex-document, save with :w, and re-compile with :, pressing the up-arrow to list command history. Now Skim should automatically show the recompiled version without asking anything.

MacVim has an option to compile the document with a keyboard shortcut (⌘B), but this seems a bit complicated to set up to use with (any-)TeX.

For general Vi(m) usage, there is a handy cheat sheet here.

  • 2
    To open the PDF in Skim in the first place you can use !open -a Skim %:r.pdf
    – Thruston
    Commented Aug 16, 2013 at 9:40
  • @Thruston: Thanks! That is very useful to know!
    – morbusg
    Commented Aug 16, 2013 at 10:15

I always run latexmk -pdf -pvc -pdflatex=lualatex in a separate terminal and edit with Vim and view the result in Skim. latexmk will recompile whenever you save in vim. The benefit being that latexmk takes care of multiple runs and all that stuff. As for running context instead of lualatex just switch to running: latexmk -pdf -pvc -pdflatex=context example.tex. And as mentioned in other answer, skim will pick up on file changes and update.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .