tex_zathurasynctex.vim 801 Bytes
Newer Older
Sebastian Ramacher's avatar
Sebastian Ramacher committed
1
" See LICENSE file for license and copyright information
2

3 4 5 6
" This is a sample plugin that can be used for synctex forward synchronization.
" It currently uses latexsuite to obtain the file name of the document. If you
" are not using latexsuite, it should be enough to adopt output accordingly.

7
" avoid re-execution
8
if exists("b:did_zathura_synctex_plugin") || !exists("*Tex_GetMainFileName")
9 10 11 12 13 14 15
  finish
endif
let b:did_zathura_synctex_plugin = 1

function! Zathura_SyncTexForward()
  let source = expand("%:p")
  let input = shellescape(line(".").":".col(".").":".source)
16
  let output = Tex_GetMainFileName(":p:r").".pdf"
17 18
  let execstr = "zathura --synctex-forward=".input." ".shellescape(output)
  silent call system(execstr)
19 20
endfunction

Sebastian Ramacher's avatar
Sebastian Ramacher committed
21
nmap <buffer> <Leader>f :call Zathura_SyncTexForward()<Enter>