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'

| 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

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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