function SetLatexVar() if !exists('b:compit') let b:compit = 1 else unlet b:compit endif endfunction function LatexCompile() if exists('b:compit') call system('pdflatex ' .. expand('%')) endif endfunction nmap z call system("zathura " .. expand("%:r") .. ".pdf &") nmap l call SetLatexVar() imap 'l byei\begin{A}\end{}hpO au BufWritePost call LatexCompile() setlocal indentexpr=""