diff --git a/autoload/vimtex/view/common.vim b/autoload/vimtex/view/common.vim index 33208b9..43265a5 100644 --- a/autoload/vimtex/view/common.vim +++ b/autoload/vimtex/view/common.vim @@ -26,6 +26,16 @@ function! vimtex#view#common#use_temp_files_p(viewer) " {{{1 return a:viewer endfunction +" }}}1 +function! vimtex#view#common#not_readable(output) " {{{1 + if !filereadable(a:output) + call vimtex#echo#warning('viewer can not read PDF file!') + return 1 + else + return 0 + endif +endfunction + " }}}1 let s:xwin_template = {} diff --git a/autoload/vimtex/view/general.vim b/autoload/vimtex/view/general.vim index be633b0..55b2add 100644 --- a/autoload/vimtex/view/general.vim +++ b/autoload/vimtex/view/general.vim @@ -52,13 +52,13 @@ function! s:general.view(file) dict " {{{1 " Only copy files if they don't exist if g:vimtex_view_use_temp_files - \ && s:output_not_readable(outfile) + \ && vimtex#view#common#not_readable(outfile) call self.copy_files() endif else let outfile = a:file endif - if s:output_not_readable(outfile) | return | endif + if vimtex#view#common#not_readable(outfile) | return | endif " Parse options let opts = g:vimtex_view_general_options @@ -96,15 +96,4 @@ endfunction " }}}1 -function! s:output_not_readable(output) " {{{1 - if !filereadable(a:output) - call vimtex#echo#warning('viewer can not read PDF file!') - return 1 - else - return 0 - endif -endfunction - -" }}}1 - " vim: fdm=marker sw=2 diff --git a/autoload/vimtex/view/mupdf.vim b/autoload/vimtex/view/mupdf.vim index d06620d..b57cc8c 100644 --- a/autoload/vimtex/view/mupdf.vim +++ b/autoload/vimtex/view/mupdf.vim @@ -83,7 +83,7 @@ function! s:mupdf.reverse_search() dict " {{{1 if !executable('synctex') | return | endif let outfile = b:vimtex.out() - if s:output_not_readable(outfile) | return | endif + if vimtex#view#common#not_readable(outfile) | return | endif if !self.xwin_exists() call vimtex#echo#warning('reverse search failed (is MuPDF open?)')