Added single shot compile command (solves #71)

This commit is contained in:
Karl Yngve Lervåg 2014-12-01 08:28:44 +01:00
parent df2ed5292b
commit 406e3725f6
2 changed files with 40 additions and 1 deletions

View File

@ -23,6 +23,7 @@ function! latex#latexmk#init(initialized) " {{{1
" Define commands
"
com! -buffer VimLatexCompile call latex#latexmk#compile()
com! -buffer VimLatexCompileSS call latex#latexmk#compile_singleshot()
com! -buffer VimLatexCompileToggle call latex#latexmk#toggle()
com! -buffer VimLatexStop call latex#latexmk#stop()
com! -buffer VimLatexStopAll call latex#latexmk#stop_all()
@ -147,6 +148,35 @@ function! latex#latexmk#compile() " {{{1
endif
endfunction
" }}}1
function! latex#latexmk#compile_singleshot() " {{{1
let data = g:latex#data[b:latex.id]
if data.pid
echomsg "latexmk is already running for `" . data.base . "'"
return
endif
let l:latex_latexmk_continuous = g:latex_latexmk_continuous
let g:latex_latexmk_continuous = 0
call s:latexmk_set_cmd(data)
let g:latex_latexmk_continuous = l:latex_latexmk_continuous
" Start latexmk
let exe = {}
let exe.null = 0
if !g:latex_latexmk_background
let exe.bg = 0
let exe.silent = 0
endif
let exe.cmd = data.cmds.compile
call latex#util#execute(exe)
if g:latex_latexmk_background
echomsg 'latexmk compiling'
endif
endfunction
" }}}1
function! latex#latexmk#errors(force) " {{{1
cclose

View File

@ -242,6 +242,7 @@ Below the commands are listed in alphabetical order.
VimLatexClean call latex#latexmk#clean()
VimLatexClean! call latex#latexmk#clean(1)
VimLatexCompile call latex#latexmk#compile()
VimLatexCompileSS call latex#latexmk#compile_singleshot()
VimLatexCompileToggle call latex#latexmk#toggle()
VimLatexErrors call latex#latexmk#errors(1)
VimLatexHelp call latex#help()
@ -657,7 +658,9 @@ Compilation is started with |latex#latexmk#compile| or may be toggled by
|latex#latexmk#toggle|. The default behaviour uses preview continuous mode of
`latexmk`, which may be disabled with |g:latex_latexmk_continuous|. If it is
disabled, then the option |g:latex_latexmk_background| may be used to decide
if the single shot compilation should run in the foreground or the background.
if single shot compilation should run in the foreground or the background.
Single shot compilation may always be issued with the function
|latex#latexmk#compile_singleshot|.
If vim is compiled with the |+clientserver| option and if
|g:latex_latexmk_callback| is enabled, then compilation errors are parsed
@ -680,6 +683,7 @@ Associated settings:
Functions:
|latex#latexmk#clean|
|latex#latexmk#compile|
|latex#latexmk#compile_singleshot|
|latex#latexmk#errors|
|latex#latexmk#output|
|latex#latexmk#status|
@ -867,6 +871,7 @@ Overview:~
|latex#info|
|latex#latexmk#clean|
|latex#latexmk#compile|
|latex#latexmk#compile_singleshot|
|latex#latexmk#errors|
|latex#latexmk#output|
|latex#latexmk#status|
@ -958,6 +963,10 @@ output files. This will only be run if `latexmk` is not already running.
*latex#latexmk#compile*
Starts `latexmk -pvc ...` for the given buffer, if it is not already running.
*latex#latexmk#compile_singleshot*
Starts a single shot compile with `latexmk ...` for the given buffer (if it is
not already running).
*latex#latexmk#errors*
Parse the log file for errors and warnings. If any errors or warnings are
found, they are displayed in the quickfix window. The exact behaviour is