Added utility function to show latexmk output

This commit is contained in:
Karl Yngve Lervåg 2014-08-02 15:09:22 +02:00
parent f9fe109baa
commit 0c5495d90c
2 changed files with 41 additions and 0 deletions

View File

@ -26,6 +26,7 @@ function! latex#latexmk#init(initialized) " {{{1
com! -buffer VimLatexStop call latex#latexmk#stop()
com! -buffer VimLatexStopAll call latex#latexmk#stop_all()
com! -buffer VimLatexErrors call latex#latexmk#errors(1)
com! -buffer VimLatexOutput call latex#latexmk#output()
com! -buffer -bang VimLatexClean call latex#latexmk#clean(<q-bang> == "!")
com! -buffer -bang VimLatexStatus call latex#latexmk#status(<q-bang> == "!")
@ -41,6 +42,7 @@ function! latex#latexmk#init(initialized) " {{{1
nnoremap <silent><buffer> <localleader>lk :call latex#latexmk#stop()<cr>
nnoremap <silent><buffer> <localleader>lK :call latex#latexmk#stop_all()<cr>
nnoremap <silent><buffer> <localleader>le :call latex#latexmk#errors(1)<cr>
nnoremap <silent><buffer> <localleader>lo :call latex#latexmk#output()<cr>
endif
"
@ -162,6 +164,36 @@ function! latex#latexmk#errors(force) " {{{1
endif
endfunction
" }}}1
function! latex#latexmk#output() " {{{1
let tmp = g:latex#data[b:latex.id].tmp
if empty(tmp) | return | endif
" Create latexmk output window
if bufnr(tmp) >= 0
silent exe 'bwipeout' . bufnr(tmp)
endif
silent exe 'split ' . tmp
" Better automatic update
augroup tmp_update
autocmd!
autocmd BufEnter * silent! checktime
autocmd CursorHold * silent! checktime
autocmd CursorHoldI * silent! checktime
autocmd CursorMoved * silent! checktime
autocmd CursorMovedI * silent! checktime
augroup END
silent exe 'autocmd! BufDelete ' . tmp . ' augroup! tmp_update'
" Set some mappings
nnoremap <buffer> <silent> q :bwipeout<cr>
" Set some buffer options
setlocal autoread
setlocal nomodifiable
endfunction
" }}}1
function! latex#latexmk#status(detailed) " {{{1
if a:detailed

View File

@ -215,6 +215,7 @@ n <localleader>ll *@:call latex#latexmk#compile()<cr>
n <localleader>lk *@:call latex#latexmk#stop(1)<cr>
n <localleader>lK *@:call latex#latexmk#stop_all()<cr>
n <localleader>le *@:call latex#latexmk#errors(1)<cr>
n <localleader>lo *@:call latex#latexmk#output()<cr>
n <localleader>lg *@:call latex#latexmk#status()<cr>
n <localleader>lG *@:call latex#latexmk#status(1)<cr>
n <localleader>lc *@:call latex#latexmk#clean()<cr>
@ -242,6 +243,7 @@ VimLatexCompile call latex#latexmk#compile()
VimLatexErrors call latex#latexmk#errors(1)
VimLatexHelp call latex#help()
VimLatexInfo call latex#info()
VimLatexOutput call latex#latexmk#output()
VimLatexRefreshFolds call latex#fold#refresh()
VimLatexReinitialize call latex#reinit()
VimLatexStatus call latex#latexmk#status()
@ -606,6 +608,7 @@ The default mappings are: >
nnoremap <localleader>lk :call latex#latexmk#stop(1)<cr>
nnoremap <localleader>lK :call latex#latexmk#stop_all()<cr>
nnoremap <localleader>le :call latex#latexmk#errors(1)<cr>
nnoremap <localleader>lo :call latex#latexmk#output()<cr>
nnoremap <localleader>lg :call latex#latexmk#status(0)<cr>
nnoremap <localleader>lG :call latex#latexmk#status(1)<cr>
nnoremap <localleader>lc :call latex#latexmk#clean(0)<cr>
@ -632,6 +635,7 @@ Functions:
|latex#latexmk#clean|
|latex#latexmk#compile|
|latex#latexmk#errors|
|latex#latexmk#output|
|latex#latexmk#status|
|latex#latexmk#stop|
|latex#latexmk#stop_all|
@ -774,6 +778,7 @@ Overview:~
|latex#latexmk#clean|
|latex#latexmk#compile|
|latex#latexmk#errors|
|latex#latexmk#output|
|latex#latexmk#status|
|latex#latexmk#stop|
|latex#latexmk#stop_all|
@ -876,6 +881,10 @@ Note: The function takes one argument, which if nonzero will force open the
quickfix window if any errors are present. This is used in the normal mode
mapping.
*latex#latexmk#output*
Opens a new buffer that show the output from the `latexmk` command. To close
the buffer, one may simply type `q`.
*latex#latexmk#status*
Show if `latexmk` has been started for the current buffer. An optional
argument may be supplied, in which case the status for all buffers is shown.