- In a script called 'vimura':
#!/bin/sh
echo $1
zathura -s -x "gvim --servername $1 -c \"let g:syncpdf='$1'\" --remote +%{line} %{input}" $*
For zathura >= 0.3.2 remove -s
.
- In your vimrc:
function! Synctex()
" remove 'silent' for debugging
execute "silent !zathura --synctex-forward " . line('.') . ":" . col('.') . ":" . bufname('%') . " " . g:syncpdf
endfunction
map <C-enter> :call Synctex()<cr>
- Build your latex doc with synctex enabled
pdflatex -synctex=1 ...
-
Open PDF with vimura script.
-
CTRL+Click
in Zathura jumps to source in vim. -
CTRL+Enter
in vim jumps to corresponding position in PDF.
Also, if you prefer not to use the
g:syncpdf
variable defined in thevimura
script, leaving you free to display it independently and still get forward search :This assumes of course corresponding root names between the tex file and the pdf file.
Also, with vim I have to redraw terminal after that, hence the "redraw!" that might not be needed with gvim.
I realize this may be going away from the initial intent, and may be less robust, but I thought it could be useful to others...