summaryrefslogtreecommitdiffstats
path: root/vim
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2018-05-20 15:32:03 -0400
committerJesse Luehrs <doy@tozt.net>2018-05-20 15:32:16 -0400
commitda40af5a2492be6b72e563976f6f00ff05d8b630 (patch)
treebd3e034378de6bb081031382e03263dc93b88b58 /vim
parent894c23169817e15b899c92b64abfca7472c66a1a (diff)
downloadconf-da40af5a2492be6b72e563976f6f00ff05d8b630.tar.gz
conf-da40af5a2492be6b72e563976f6f00ff05d8b630.zip
try to call synctex a bit less often
Diffstat (limited to 'vim')
-rw-r--r--vim/ftplugin/tex.vim13
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