- 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.
An update for this great gist in order to use it with NeoVim
NeoVim don't have
--servername
syntax natively, but you can use neovim-remote :then the
vimura
script :Also, in order to execute background jobs from neovim, we must use
jobstart()
instead of terminating the command by&
. Thus, in.vimrc
:Note that I added
redraw!
at the end, and I use full path with%:p
so I can deal with multiple pdf in multiple directories.