diff options
author | doy <doy@tozt.net> | 2009-01-04 06:50:41 -0500 |
---|---|---|
committer | doy <doy@tozt.net> | 2009-01-04 06:50:41 -0500 |
commit | e4bb938e391274781945011e5d1b2ab410ac775e (patch) | |
tree | 75ff9d10fe33659709a580c3493dcf263cfc3cf5 /vim/ftplugin/tex.vim | |
parent | a65585a3a3309a6e3d6d91261c5b94af8474fc21 (diff) | |
download | conf-e4bb938e391274781945011e5d1b2ab410ac775e.tar.gz conf-e4bb938e391274781945011e5d1b2ab410ac775e.zip |
ftplugins are per-buffer, so they might be sourced multiple times... make that not break
Diffstat (limited to 'vim/ftplugin/tex.vim')
-rw-r--r-- | vim/ftplugin/tex.vim | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/vim/ftplugin/tex.vim b/vim/ftplugin/tex.vim index 0323d30..dedfe76 100644 --- a/vim/ftplugin/tex.vim +++ b/vim/ftplugin/tex.vim @@ -2,7 +2,7 @@ setlocal makeprg=(cd\ /tmp\ &&\ pdflatex\ --halt-on-error\ %:p) " xpdf needs to be manually refreshed when the file changes -function s:xpdf() +function! s:xpdf() let pdf = '/tmp/' . expand('<afile>:t:r') . '.pdf' let processes = split(system('ps xo args'), '\n') for process in processes @@ -14,12 +14,12 @@ function s:xpdf() call system('xpdf -remote localhost ' . pdf . ' &') endfunction " evince treats opening the same file twice as meaning 'reload' -function s:evince() +function! s:evince() let pdf = '/tmp/' . expand('<afile>:t:r') . '.pdf' system('evince ' . pdf . ' &') endfunction " don't load the pdf if the make failed -function s:make_errors() +function! s:make_errors() let qf = getqflist() for line in qf if line['type'] == 'E' @@ -28,11 +28,14 @@ function s:make_errors() endfor return 0 endfunction +augroup _tex +autocmd! if executable('xpdf') && strlen(expand('$DISPLAY')) autocmd QuickFixCmdPost make if !s:make_errors() | call s:xpdf() | endif elseif executable('evince') && strlen(expand('$DISPLAY')) autocmd QuickFixCmdPost make if !s:make_errors() | call s:evince() | endif endif +augroup END " see :help errorformat-LaTeX setlocal errorformat= |