diff options
Diffstat (limited to 'vim/ftplugin/tex.vim')
-rw-r--r-- | vim/ftplugin/tex.vim | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/vim/ftplugin/tex.vim b/vim/ftplugin/tex.vim index c600070..3a62790 100644 --- a/vim/ftplugin/tex.vim +++ b/vim/ftplugin/tex.vim @@ -30,13 +30,22 @@ function! s:is_running(re) return 0 endfunction -function! Synctex() +function! s:synctex() if s:is_running('^zathura') exe "silent !zathura --synctex-forward " . line('.') . ":" . col('.') . ":" . expand('%:p') . " " . s:current_pdf() redraw endif endfunction +let g:_tex_last_line_seen = -1 +function! s:cursor_moved() + let line = line('.') + if line != g:_tex_last_line_seen + call s:synctex() + endif + let g:_tex_last_line_seen = line +endfunction + " don't load the pdf if the make failed function! s:make_errors() let qf = getqflist() @@ -53,7 +62,7 @@ augroup _tex if executable('zathura') && strlen(expand('$DISPLAY')) autocmd QuickFixCmdPost make if !s:make_errors() | call s:zathura() | endif endif - autocmd CursorMoved <buffer> call Synctex() + autocmd CursorMoved <buffer> call s:cursor_moved() augroup END " see :help errorformat-LaTeX |