# Vim shortcut to pdflatex a specific tex file

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

``````/Document/
|
|--Chapter1/chap1.tex
|
|--Chapter2/chap2.tex
|
|--Chapter3/chap3.tex
|
\--main.tex
``````

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

`:buildme`

which will cause the following terminal command will be executed:

`\$ cd .. ; pdflatex 'main.tex'`

-
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

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