Fix #421: Problem with quickfix entries

This commit is contained in:
Karl Yngve Lervåg 2016-04-09 13:30:30 +02:00
parent 2f04e8f962
commit 0f59eb086a

View File

@ -49,7 +49,7 @@ function! vimtex#latexmk#init_script() " {{{1
if g:vimtex_quickfix_fix_paths if g:vimtex_quickfix_fix_paths
augroup vimtex_latexmk_fix_dirs augroup vimtex_latexmk_fix_dirs
au! au!
au QuickFixCmdPre c*file call s:fix_quickfix_paths() au QuickFixCmdPost c*file call s:fix_quickfix_paths()
augroup END augroup END
endif endif
endfunction endfunction
@ -242,7 +242,7 @@ function! vimtex#latexmk#errors_open(force) " {{{1
endif endif
" Save root name for fixing quickfix paths " Save root name for fixing quickfix paths
let s:vimtex_tmp_path = b:vimtex.root let s:root = b:vimtex.root
if g:vimtex_quickfix_autojump if g:vimtex_quickfix_autojump
execute 'cfile ' . fnameescape(log) execute 'cfile ' . fnameescape(log)
@ -543,16 +543,17 @@ endfunction
" }}}1 " }}}1
function! s:fix_quickfix_paths() " {{{1 function! s:fix_quickfix_paths() " {{{1
let qflist = getqflist() let l:qflist = getqflist()
for i in qflist for l:qf in l:qflist
let file = s:vimtex_tmp_path . '/' let l:file = fnamemodify(simplify(s:root . '/' . bufname(l:qf.bufnr)), ':.')
\ . substitute(bufname(i.bufnr), '^\.\/', '', '') if !filereadable(l:file) | continue | endif
if !bufexists(file) && filereadable(fnameescape(file))
execute 'badd' fnamemodify(file, ':~:.') if !bufexists(l:file)
execute 'badd' l:file
endif endif
let i.bufnr = bufnr(file) let l:qf.bufnr = bufnr(l:file)
endfor endfor
call setqflist(qflist) call setqflist(l:qflist)
endfunction endfunction
" }}}1 " }}}1