rabee <rabeetou...@...> writes:
> 
> I looking for a simple vim script (recipe) which does the following
> 
> everytime a .tex file is opend in macvim a new terminal.app window is
> opened and the commands
> cd <directory of filename.tex>
> latexmk.pl -pvc <filename.tex>
> 
> is run.

I have a similar setup (I use my own script instead of latexmk).
I couldn't find an elegant way to do this, but the following works.

The first part is a Perl script that you can call 'launch_latexmk'. 
It receives as a parameter the name of 
the .tex file, does a few things, and eventually 
launches a terminal window running latexmk -pvc 
yourtexfile. Here it is:

#!/usr/bin/perl -w

use IO::File;
use strict;

my $texfile = $ARGV[0];

my $tmpfile = "/tmp/my_launch_latexmk";

my $dir = `pwd`;
chomp $dir;

my $f = IO::File->new("> $tmpfile");
$f->print("#!/bin/bash
# Automatically created by launch_latexmk
cd $dir
latexmk.pl -pvc $texfile
");
system("chmod +x $tmpfile");
system("open -a /Applications/Utilities/Terminal.app $tmpfile");


The second part is a vim binding to run this when 
entering a new tex file is opened (assuming this 
launch_latexmk is in your $path):

au BufRead *.tex silent !launch_latexmk %:p



-- 
You received this message from the "vim_mac" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to