Hi,

after some playing and searching the internet I was able to use zathura
synctex support, by opening a file:
zathura -s -x 'gvim --servername SYNCTEX --remote +\%{line} \%{input}' Introduction_en.pdf
and switching to the specified line:
zathura --synctex-forward 100:1:<fullpath>/Introduction_en.tex Introduction_en.pdf

If I try to combine these two commands I get an error saying that the
opened instance for Introduction_en.pdf is not found.
I wonder why this distinction is made? Is there a way to open zathura and
sync if file is not opened, or simply sync if the opened instance exists?

Here is the vim code to sync or run zathura, which is ugly, because instead of one function I need three:

function! StartZathura( pdfname )
      let cmd = "silent !zathura -s -x "
let backcmd = "'gvim --servername ".v:servername." --remote +\\%{line}
\\%{input}' "
      let execstr = cmd.backcmd.a:pdfname.'&'
      exec execstr
endf

function! SyncZathura( pdfname, status )
      let cmd = "silent !zathura --synctex-forward "
      let path = line(".").":".col(".").":".expand("%:p")." "
      let execstr = cmd.path.a:pdfname
      if !a:status
          let execstr.=' &'
      endif
      exec execstr
      return v:shell_error
endf

function! StartOrSyncZathura( pdfname )
      if !SyncZathura( a:pdfname, 1 )
          return
      endif
      call StartZathura( a:pdfname )
      sleep 300m
      call SyncZathura( a:pdfname, 0 )
endf

regards,
Maxim
_______________________________________________
zathura mailing list
zathura@lists.pwmt.org
http://lists.pwmt.org/mailman/listinfo/zathura

Reply via email to