Reputation: 479
This is in reference to the accepted answer here written by Paul Biggar:
After considering all these options for some time, I have settled with the following solution.
- Set vim to write continuously as I type.
- Run a script in the background to build continuously, refreshing the pdf as it goes. latexmk is nearly good enough, except that it builds in place, which gets reloaded at a bad time in okular (my viewer). The script is available at https://github.com/pbiggar/texbuild.
Use rubber-info to get the errors and warnings from the log file. The script above saves the log file in t.log. In vim:
autocmd FileType tex set makeprg=rubber-info\ t.log autocmd FileType tex set errorformat=%f:%l:\ %m
I want to execute his github script in order to "build [LaTeX files] continuously, refreshing the pdf as it goes." Given that he doesn't exactly offer instructions how to run it, I assume this is a rather trivial procedure. However, I'm quite new at vim and know very little about programming/github in general, so I really have no clue how to start.
I've searched high and low, and have made zero progress. I'm not sure if the code is supposed to be compiled in python, then run as a script, or anything similar. I appreciate your help!
EDIT: As per the comments discussion, I've successfully made the script executable. But I still don't know how to run it..?
Upvotes: 3
Views: 519
Reputation: 53674
The
#!/usr/bin/env python
at the top of the script states, as well as absence of import vim
in the body clearly states that it should be run from the shell (or from vim) using
chmod +x /path/to/texbuild # Needed only once
/path/to/texbuild {script-args}
. Further exploration reveals that it expects to have one tex file as its first and only argument (the only place where sys.argv
is mentioned is line 48) hence it is likely that you should use the following to run it:
augroup AutorunTexbuild
autocmd!
autocmd FileType tex :if !exists('b:runtexbuild') | call system('/path/to/texbuild '.shellescape(@%)) | let b:runtexbuild=1 | endif
autocmd VimLeave * :call system('killall -TERM texbuild')
augroup END
. That assumes that you edit tex files only in one vim instance at a time. It looks like author expected you to run that script manually.
Upvotes: 1