aboutsummaryrefslogtreecommitdiff
path: root/vim/.vim/after/ftplugin/tex.vim
blob: a3b5ee2b20ac5c2ba5cf112a9745f6b16cec519d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
setlocal spell spelllang=en_gb
setlocal tabstop=2 shiftwidth=2
setlocal formatoptions-=t

function! SyncTeXToPDF()
	call system('zathura --synctex-forward ' .
				\ line('.') . ':' . col('.') . ':' . shellescape(bufname('%')) . ' ' .
				\ shellescape(g:synctex_zathura_pdf_filename))
endfunction

function! g:SyncPDFToTeX(input, line)
	" Focus the window vim is running in.
	exe "silent !i3-msg '[id=\"" . environ()['WINDOWID'] . "\"] focus'"
	" Open the file name and jump to the right line.
	" Mysteriously, we need `cd .` to fix the file name in the tabline.
	" Putting this in one `exe` seems to reduce flickering.
	exe 'tab drop ' . a:input . ' | silent ' . a:line . ' | silent cd .'
endfunction

map <C-T> :call SyncTeXToPDF()<CR>