function! GetMainDoc() let l:maindoc = search('\\begin{document}', "cnw") if l:maindoc > 0 return '%' else " Find the main document file " Must be in the same folder of the current file let l:maindocscmd = "grep -lrE '\\\\begin{document}' " . expand('%:h') . "/*.tex" let l:maindocssys = system(l:maindocscmd) let l:maindocs = split(l:maindocssys) if len(l:maindocs) > 0 " Use the first document containing `begin{document}` return l:maindocs[0] else return "" endif endif endfunction function! CompileMainDoc() let l:latexcmd ='autocmd BufWritePost ! \ latexrun --latex-args="-synctex=1 -interaction=nonstopmode" ' execute(l:latexcmd . GetMainDoc()) endfunction "function! Synctex() " " remove 'silent' for debugging " let l:doc = GetMainDoc() " execute "silent !mv -u latex.out/" . substitute(l:doc, '\.tex', '') . ".synctex.gz ." " execute "silent !zathura --synctex-forward " . line('.') . ":" . col('.') . ":" . bufname('%') . " " . expand('%:t:r') . ".pdf" " redraw! "endfunction function! Synctex() " remove 'silent' for debugging execute "silent !zathura --synctex-forward " . line('.') . ":" . col('.') . ":" . bufname('%') . " " . g:syncpdf redraw! endfunction nmap :call Synctex() setlocal spell setlocal spelllang=en_us imap FTT \texttt{}i imap FBF \textbf{}i imap FIT \textit{}i imap FSC \textsc{}i imap MTT \mathtt{}i imap MBF \mathbf{}i imap MIT \mathit{}i imap MSC \mathsc{}i imap (( \left(\right)F\i imap {{ \left\{\right\}F\F\i imap [[ \left[\right]F\i imap ~~ \neg imap /\ \land imap \/ \lor imap -> \rightarrow imap ==> \Rightarrow imap <== \Leftarrow imap <=> \Leftrightarrow imap \|- \vdash imap \|= \vDash imap !-- \inference[]{%}{%}kk$F[a imap !== \begin{align*}\end{align*}O imap !ii \begin{itemize}\end{itemize}O\item Case imap CC \item Case imap EIMP \expEimp{<++>}{<++>}{<++>}F\ imap [[ [\![ imap ]] ]\!] imap CI $\land\mbox{I}$ imap CE1 $\land\mbox{E}_1$ imap CE2 $\land\mbox{E}_2$ imap DI1 $\lor\mbox{I}_1$ imap DI2 $\lor\mbox{I}_2$ imap DE $\lor\mbox{E}$ imap II $\Rightarrow\mbox{I}$ imap IE $\Rightarrow\mbox{E}$ imap NE $\neg\mbox{E}$ imap NI $\neg\mbox{I}$ imap MCC \mathcal{}<++>T{i inoremap /<++>cf> noremap /<++>cf> vnoremap `it `>a}` vnoremap `bf `>a}` vnoremap `tt `>a}` vnoremap `mi `>a}` vnoremap `mb `>a}` vnoremap `mt `>a}` " put \begin{} \end{} tags tags around the current word vnoremap YpkI\begin{A}jI\end{A}kA syntax sync minlines=10000 "setlocal spell spelllang=en_US call CompileMainDoc() " autocmd BufRead *.tex imap /\ \land " autocmd BufRead *.tex imap \/ \lor " autocmd BufRead *.tex imap -> \rightarrow " autocmd BufRead *.tex imap ~~ \neg