diff options
-rw-r--r-- | vim/ftplugin/perl.vim | 2 | ||||
-rw-r--r-- | vim/ftplugin/tex.vim | 9 |
2 files changed, 7 insertions, 4 deletions
diff --git a/vim/ftplugin/perl.vim b/vim/ftplugin/perl.vim index 62694ca..188b325 100644 --- a/vim/ftplugin/perl.vim +++ b/vim/ftplugin/perl.vim @@ -3,7 +3,7 @@ setlocal makeprg=$VIMRUNTIME/tools/efm_perl.pl\ -c\ %\ $* setlocal errorformat=%f:%l:%m " look up words in perldoc rather than man for K -function s:perldoc(visual) +function! s:perldoc(visual) if a:visual let oldreg = @a normal `<"ay`>gv 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= |