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'

  • Do you use vim-latex-suite?
    – m0nhawk
    May 4, 2013 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, 2013 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, 2013 at 18:28
  • @m0nhawk very cool. Thanks. I will definitely give vim-latex-suite a try. Looks very helpful.
    – synaptik
    May 4, 2013 at 20:12

1 Answer 1


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

 command! Buildme exec('cd ..|!pdflatex main.tex')

You must log in to answer this question.

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