aboutsummaryrefslogtreecommitdiff
path: root/vim/.latexmkrc
blob: c4ec9ee85ffb6a3967a97ca6cbc14d6893b23236 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# vim: ft=perl:
$pdf_mode = 1;

# With the following, `latexmk -pvc jobname.tex` opens a zathura instance for
# the generated PDF alongside an nvim editor, and sets up synctex from zathura
# to vim.

# create a vim rpc socket based on the filename
$pdf_previewer = 'SERVER=/tmp/vim-latexmk-`md5sum %T | cut -d\' \' -f1`;';

# zathura for viewing
$pdf_previewer .= 'zathura';
# -x for synctex: connect to the rpc socket, switch to the file and jump to the line
$pdf_previewer .= ' -x "nvim --headless --cmd';
$pdf_previewer .= ' \'let skt=sockconnect(\\"pipe\\",\\"$SERVER\\",{\\"rpc\\":1})';
$pdf_previewer .= ' | call rpcrequest(skt,\\"nvim_command\\",\\"call SyncPDFToTeX(\\\\\\"%{input}\\\\\\",\\\\\\"%{line}\\\\\\")\\")';
$pdf_previewer .= ' | call chanclose(skt)';
$pdf_previewer .= ' | quit\'"';
# final argument for zathura is the PDF
$pdf_previewer .= ' %S &';

# nvim for editing; start up the server as part of the command line
$pdf_previewer .= 'urxvt -e nvim';
$pdf_previewer .= ' --cmd "let g:server_name = serverstart(\'$SERVER\')"';
# this is for forward synctex; see .vim/after/ftplugin/tex.vim
$pdf_previewer .= ' --cmd "let g:synctex_zathura_pdf_filename = \'%S\'"';
$pdf_previewer .= ' %T';

push @extra_pdflatex_options, '-synctex=1' ;
push @extra_pdflatex_options, '-halt-on-error' ;
push @extra_pdflatex_options, '-file-line-error' ;
push @extra_pdflatex_options, '-interaction nonstopmode' ;