diff --git a/autoload/latex/latexmk.vim b/autoload/latex/latexmk.vim index a659da3..8269470 100644 --- a/autoload/latex/latexmk.vim +++ b/autoload/latex/latexmk.vim @@ -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( == "!") com! -buffer -bang VimLatexStatus call latex#latexmk#status( == "!") @@ -41,6 +42,7 @@ function! latex#latexmk#init(initialized) " {{{1 nnoremap lk :call latex#latexmk#stop() nnoremap lK :call latex#latexmk#stop_all() nnoremap le :call latex#latexmk#errors(1) + nnoremap lo :call latex#latexmk#output() 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 q :bwipeout + + " Set some buffer options + setlocal autoread + setlocal nomodifiable +endfunction + " }}}1 function! latex#latexmk#status(detailed) " {{{1 if a:detailed diff --git a/doc/latex.txt b/doc/latex.txt index 5bbf07c..445cf7c 100644 --- a/doc/latex.txt +++ b/doc/latex.txt @@ -215,6 +215,7 @@ n ll *@:call latex#latexmk#compile() n lk *@:call latex#latexmk#stop(1) n lK *@:call latex#latexmk#stop_all() n le *@:call latex#latexmk#errors(1) +n lo *@:call latex#latexmk#output() n lg *@:call latex#latexmk#status() n lG *@:call latex#latexmk#status(1) n lc *@:call latex#latexmk#clean() @@ -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 lk :call latex#latexmk#stop(1) nnoremap lK :call latex#latexmk#stop_all() nnoremap le :call latex#latexmk#errors(1) + nnoremap lo :call latex#latexmk#output() nnoremap lg :call latex#latexmk#status(0) nnoremap lG :call latex#latexmk#status(1) nnoremap lc :call latex#latexmk#clean(0) @@ -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.