Fixed #518: Problem with bib file in TOC

This commit is contained in:
Karl Yngve Lervåg 2016-08-09 21:34:26 +02:00
parent a48df211a0
commit 0aa85a6c9d

View File

@ -170,19 +170,20 @@ endfunction
" }}}1 " }}}1
function! vimtex#util#kpsewhich(file, ...) " {{{1 function! vimtex#util#kpsewhich(file, ...) " {{{1
execute 'lcd' b:vimtex.root
let cmd = 'kpsewhich ' let cmd = 'kpsewhich '
let cmd .= a:0 > 0 ? a:1 : '' let cmd .= a:0 > 0 ? a:1 : ''
let cmd .= ' "' . a:file . '"' let cmd .= ' "' . a:file . '"'
let out = system(cmd) let output = split(system(cmd), '\n')
lcd -
" If kpsewhich has found something, it returns a non-empty string with a if empty(output) | return '' | endif
" newline at the end; otherwise the string is empty let filename = output[0]
if len(out)
" Remove the trailing newline
let out = fnamemodify(out[:-2], ':p')
endif
return out " If path is already absolute, return it
return filename[0] ==# '/'
\ ? filename
\ : simplify(b:vimtex.root . '/' . filename)
endfunction endfunction
" }}}1 " }}}1