TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm working on a document that is structured as follows:


where the file main.tex includes the 3 chapter tex files shown.

Using Vim, I edit each of the files chap1.tex, chap2.tex, and chap3.tex often. I want to configure a shortcut so that within the Vim editor, I can enter something like


which will cause the following terminal command will be executed:

$ cd .. ; pdflatex 'main.tex'

share|improve this question
Do you use vim-latex-suite? – m0nhawk May 4 '13 at 17:09
@m0nhawk No, I don't. I usually use Winefish for tex, and Vim for general text editing purposes. But I'm thinking about switch my tex editing to Vim. – synaptik May 4 '13 at 17:11
In vim-latex-suite you can use this. That's, I think, the most pretty way to do this. – m0nhawk May 4 '13 at 18:28
@m0nhawk very cool. Thanks. I will definitely give vim-latex-suite a try. Looks very helpful. – synaptik May 4 '13 at 20:12
up vote 0 down vote accepted

User commands need to start with a capital letter; try the following:

 command! Buildme exec('cd ..|!pdflatex main.tex')
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.