[Vim-latex-cvs] vimfiles/ftplugin/latex-suite compiler.vim,1.16,1.17
Brought to you by:
srinathava,
tmaas
From: <sri...@us...> - 2002-11-27 10:25:11
|
Update of /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite In directory sc8-pr-cvs1:/tmp/cvs-serv17073 Modified Files: compiler.vim Log Message: More bug fixes/robustification. Took care of potential problems when . more than 2 files have errors on the same line. . the file with the error is being \inputed into the main file. Index: compiler.vim =================================================================== RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/compiler.vim,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** compiler.vim 27 Nov 2002 08:18:24 -0000 1.16 --- compiler.vim 27 Nov 2002 10:25:07 -0000 1.17 *************** *** 38,42 **** else call input( ! \'No compilation rule defined for target '.target."\n". \'Please specify a rule in texrc.vim'."\n". \' :help latex-compiler-target'."\n". --- 38,42 ---- else call input( ! \'No '.a:type.' rule defined for target '.target."\n". \'Please specify a rule in texrc.vim'."\n". \' :help latex-compiler-target'."\n". *************** *** 127,131 **** exe 'nnoremap <buffer> <silent> <up> <up>:call UpdatePreviewWindow("'.mainfname.'")<CR>' exe 'nnoremap <buffer> <silent> <down> <down>:call UpdatePreviewWindow("'.mainfname.'")<CR>' ! exe 'nnoremap <buffer> <silent> <enter> <enter>:call GotoErrorLocation("'.mainfname.'", '.winnum.')<CR>' setlocal nowrap --- 127,131 ---- exe 'nnoremap <buffer> <silent> <up> <up>:call UpdatePreviewWindow("'.mainfname.'")<CR>' exe 'nnoremap <buffer> <silent> <down> <down>:call UpdatePreviewWindow("'.mainfname.'")<CR>' ! exe 'nnoremap <buffer> <silent> <enter> :call GotoErrorLocation("'.mainfname.'")<CR>' setlocal nowrap *************** *** 133,137 **** " resize the window to just fit in with the number of lines. exec ( line('$') < 4 ? line('$') : 4 ).' wincmd _' ! call GotoErrorLocation(mainfname, winnum) endif --- 133,137 ---- " resize the window to just fit in with the number of lines. exec ( line('$') < 4 ? line('$') : 4 ).' wincmd _' ! call GotoErrorLocation(mainfname) endif *************** *** 237,240 **** --- 237,248 ---- " }}} + + " ============================================================================== + " Helper functions for + " . viewing the log file in preview mode. + " . syncing the display between the quickfix window and preview window + " . going to the correct line _and column_ number from from the quick fix + " window. + " ============================================================================== " PositionPreviewWindow: positions the preview window correctly. {{{ " Description: *************** *** 244,251 **** --- 252,261 ---- " lines in the quickfix window before this line which also contain lines " like |10 error|. + " function! PositionPreviewWindow(filename) if getline('.') !~ '|\d\+ \(error\|warning\)|' if !search('|\d\+ \(error\|warning\)|') + echomsg "not finding error pattern anywhere in quickfix window :".bufname(bufnr('%')) pclose! return *************** *** 253,259 **** endif ! " extract the error pattern (something like '|10 error|') on the current ! " line. ! let errpat = matchstr(getline('.'), '\zs|\d\+ \(error\|warning\)|\ze') " extract the line number from the error pattern. let linenum = matchstr(getline('.'), '|\zs\d\+\ze \(error\|warning\)|') --- 263,270 ---- endif ! " extract the error pattern (something like 'file.tex|10 error|') on the ! " current line. ! let errpat = matchstr(getline('.'), '^\f*|\d\+ \(error\|warning\)|\ze') ! let errfile = matchstr(getline('.'), '^\f*\ze|\d\+ \(error\|warning\)|') " extract the line number from the error pattern. let linenum = matchstr(getline('.'), '|\zs\d\+\ze \(error\|warning\)|') *************** *** 296,311 **** endif ! exec 'bot pedit +/'.searchpat.'/ '.a:filename.'.log' " TODO: This is not robust enough. Check that a wincmd j actually takes ! " us to the preview window. Moreover, the resizing should be done only the ! " first time around. wincmd j if searchpat =~ 'l.\d\+' && numrep > 1 ! while numrep > 1 call search(searchpat, 'W') - normal! z. let numrep = numrep - 1 endwhile endif endfunction " }}} --- 307,331 ---- endif ! " We first need to be in the scope of the correct file in the .log file. ! " This is important for example, when a.tex and b.tex both have errors on ! " line 9 of the file and we want to go to the error of b.tex. Merely ! " searching forward from the beginning of the log file for l.9 will always ! " land us on the error in a.tex. ! if errfile != '' ! exec 'bot pedit +/(\(\f\|\[\|\]\)*'.errfile.'/ '.a:filename.'.log' ! else ! exec 'bot pedit +0 '.a:filename.'.log' ! endif ! " Goto the preview window " TODO: This is not robust enough. Check that a wincmd j actually takes ! " us to the preview window. wincmd j if searchpat =~ 'l.\d\+' && numrep > 1 ! while numrep > 0 call search(searchpat, 'W') let numrep = numrep - 1 endwhile endif + normal! z. endfunction " }}} *************** *** 320,325 **** function! UpdatePreviewWindow(filename) call PositionPreviewWindow(a:filename) ! 6 wincmd _ ! wincmd k endfunction " }}} " GotoErrorLocation: goes to the correct location of error in the tex file {{{ --- 340,348 ---- function! UpdatePreviewWindow(filename) call PositionPreviewWindow(a:filename) ! ! if &previewwindow ! 6 wincmd _ ! wincmd k ! endif endfunction " }}} " GotoErrorLocation: goes to the correct location of error in the tex file {{{ *************** *** 335,340 **** " TODO: When there are multiple errors on the same line, this only takes you " to the very first error every time. ! function! GotoErrorLocation(filename, winnum) let linenum = matchstr(getline('.'), '|\zs\d\+\ze \(warning\|error\)|') call PositionPreviewWindow(a:filename) --- 358,372 ---- " TODO: When there are multiple errors on the same line, this only takes you " to the very first error every time. ! function! GotoErrorLocation(filename) + " first use vim's functionality to take us to the location of the error + " accurate to the line (not column). This lets us go to the correct file + " without applying any logic. + exec "normal! \<enter>" + let winnum = winnr() + " then come back to the quickfix window + wincmd w + + " find out where in the file we had the error. let linenum = matchstr(getline('.'), '|\zs\d\+\ze \(warning\|error\)|') call PositionPreviewWindow(a:filename) *************** *** 368,372 **** endif ! exec a:winnum.' wincmd w' exec 'silent! '.linenum.' | normal! '.normcmd --- 400,405 ---- endif ! " go back to the window where we came from. ! exec winnum.' wincmd w' exec 'silent! '.linenum.' | normal! '.normcmd |