[Vim-latex-cvs] vimfiles/ftplugin/latex-suite compiler.vim,1.40,1.40.2.1
Brought to you by:
srinathava,
tmaas
From: <sri...@us...> - 2003-08-28 23:20:36
|
Update of /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite In directory sc8-pr-cvs1:/tmp/cvs-serv17465 Modified Files: Tag: latex-multi-compile compiler.vim Log Message: support for compiling multiple times and handling format dependency Index: compiler.vim =================================================================== RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/compiler.vim,v retrieving revision 1.40 retrieving revision 1.40.2.1 diff -C2 -d -r1.40 -r1.40.2.1 *** compiler.vim 18 Jun 2003 00:57:24 -0000 1.40 --- compiler.vim 28 Aug 2003 23:20:22 -0000 1.40.2.1 *************** *** 40,44 **** \'No '.a:type.' rule defined for target '.target."\n". \'Please specify a rule in texrc.vim'."\n". ! \' :help latex-compiler-target'."\n". \'for more information', \"&ok", 1, 'Warning') --- 40,44 ---- \'No '.a:type.' rule defined for target '.target."\n". \'Please specify a rule in texrc.vim'."\n". ! \' :help Tex_CompileRule_format'."\n". \'for more information', \"&ok", 1, 'Warning') *************** *** 47,51 **** \'No '.a:type.' rule defined for target '.target."\n". \'Please specify a rule in texrc.vim'."\n". ! \' :help latex-compiler-target'."\n". \'for more information' \) --- 47,51 ---- \'No '.a:type.' rule defined for target '.target."\n". \'Please specify a rule in texrc.vim'."\n". ! \' :help Tex_ViewRule_format'."\n". \'for more information' \) *************** *** 85,108 **** " }}} ! " RunLaTeX: compilation function {{{ ! " this function runs the latex command on the currently open file. often times ! " the file being currently edited is only a fragment being \input'ed into some ! " master tex file. in this case, make a file called mainfile.latexmain in the ! " directory containig the file. in other words, if the current file is ! " ~/thesis/chapter.tex ! " so that doing "latex chapter.tex" doesnt make sense, then make a file called ! " main.tex.latexmain ! " in the ~/thesis directory. this will then run "latex main.tex" when ! " RunLaTeX() is called. ! function! RunLaTeX() ! ! call Tex_Debug('getting to RunLaTeX, b:fragmentFile = '.exists('b:fragmentFile')) if &ft != 'tex' echo "calling RunLaTeX from a non-tex file" return end - let dir = expand("%:p:h").'/' - let curd = getcwd() - exec 'cd '.expand("%:p:h") " close any preview windows left open. --- 85,95 ---- " }}} ! " Tex_CompileLatex: compiles the present file. {{{ ! " Description: ! function! Tex_CompileLatex() if &ft != 'tex' echo "calling RunLaTeX from a non-tex file" return end " close any preview windows left open. *************** *** 146,149 **** --- 133,144 ---- endif redraw! + endfunction " }}} + " Tex_SetupErrorWindow: sets up the cwindow and preview of the .log file {{{ + " Description: + function! Tex_SetupErrorWindow() + let mainfname = Tex_GetMainFileName(':r') + if exists('b:fragmentFile') || mainfname == '' + let mainfname = expand('%:t') + endif let winnum = winnr() *************** *** 173,176 **** --- 168,219 ---- endif + endfunction " }}} + " RunLaTeX: compilation function {{{ + " this function runs the latex command on the currently open file. often times + " the file being currently edited is only a fragment being \input'ed into some + " master tex file. in this case, make a file called mainfile.latexmain in the + " directory containig the file. in other words, if the current file is + " ~/thesis/chapter.tex + " so that doing "latex chapter.tex" doesnt make sense, then make a file called + " main.tex.latexmain + " in the ~/thesis directory. this will then run "latex main.tex" when + " RunLaTeX() is called. + function! RunLaTeX() + call Tex_Debug('getting to RunLaTeX, b:fragmentFile = '.exists('b:fragmentFile'), 'comp') + + let dir = expand("%:p:h").'/' + let curd = getcwd() + exec 'cd '.expand("%:p:h") + + " first get the dependency chain of this format. + let dependency = s:target + if exists('g:Tex_FormatDependency_'.s:target) + if g:Tex_FormatDependency_{s:target} !~ ','.s:target.'$' + let dependency = g:Tex_FormatDependency_{s:target}.','.s:target + else + let dependency = g:Tex_FormatDependency_{s:target} + endif + endif + + call Tex_Debug('getting dependency chain = ['.dependency.']', 'comp') + + " now compile to the final target format via each dependency. + let i = 1 + while Tex_Strntok(dependency, ',', i) != '' + let s:target = Tex_Strntok(dependency, ',', i) + call SetTeXCompilerTarget('Compile', s:target) + call Tex_Debug('setting target to '.s:target, 'comp') + + if g:Tex_MultipleCompileFormats =~ '\<'.s:target.'\>' + call Tex_CompileMultipleTimes() + else + call Tex_CompileLatex() + endif + + let i = i + 1 + endwhile + + call Tex_SetupErrorWindow() + exec 'cd '.curd endfunction *************** *** 243,247 **** " }}} ! " ForwardSearchLaTeX: searches for current location in dvi file. {{{ " Description: if the DVI viewr is compatible, then take the viewer to that " position in the dvi file. see docs for RunLaTeX() to set a --- 286,290 ---- " }}} ! " Tex_ForwardSearchLaTeX: searches for current location in dvi file. {{{ " Description: if the DVI viewr is compatible, then take the viewer to that " position in the dvi file. see docs for RunLaTeX() to set a *************** *** 254,258 **** " For inverse search, if you are reading this, then just pressing \ls " will work. ! function! ForwardSearchLaTeX() if &ft != 'tex' echo "calling ViewLaTeX from a non-tex file" --- 297,301 ---- " For inverse search, if you are reading this, then just pressing \ls " will work. ! function! Tex_ForwardSearchLaTeX() if &ft != 'tex' echo "calling ViewLaTeX from a non-tex file" *************** *** 417,421 **** " land us on the error in a.tex. if errfile != '' ! exec 'bot pedit +/(\(\f\|\[\|\]\)*'.errfile.'/ '.a:filename else exec 'bot pedit +0 '.a:filename --- 460,464 ---- " land us on the error in a.tex. if errfile != '' ! exec 'bot pedit +/(\\(\\f\\|\\[\\|\]\\)*'.errfile.'/ '.a:filename else exec 'bot pedit +0 '.a:filename *************** *** 525,534 **** vnoremap <buffer> <Leader>ll :call Tex_PartCompile()<cr> nnoremap <buffer> <Leader>lv :silent! call ViewLaTeX()<cr> ! nnoremap <buffer> <Leader>ls :silent! call ForwardSearchLaTeX()<cr> else nnoremap <buffer> <Leader>ll :call RunLaTeX()<cr> vnoremap <buffer> <Leader>ll :call Tex_PartCompile()<cr> nnoremap <buffer> <Leader>lv :call ViewLaTeX()<cr> ! nnoremap <buffer> <Leader>ls :call ForwardSearchLaTeX()<cr> end end --- 568,577 ---- vnoremap <buffer> <Leader>ll :call Tex_PartCompile()<cr> nnoremap <buffer> <Leader>lv :silent! call ViewLaTeX()<cr> ! nnoremap <buffer> <Leader>ls :silent! call Tex_ForwardSearchLaTeX()<cr> else nnoremap <buffer> <Leader>ll :call RunLaTeX()<cr> vnoremap <buffer> <Leader>ll :call Tex_PartCompile()<cr> nnoremap <buffer> <Leader>lv :call ViewLaTeX()<cr> ! nnoremap <buffer> <Leader>ls :call Tex_ForwardSearchLaTeX()<cr> end end |