aboutsummaryrefslogtreecommitdiff
path: root/vim/.vim/after/ftplugin/tex.vim
blob: 66be81dd925cd63da10c56b25514a1caadfa8408 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
setlocal spell spelllang=en_us
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

if !exists("*g:SyncPDFToTeX")
	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
endif

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