diff options
Diffstat (limited to 'ftplugin/latextoc.vim')
-rw-r--r-- | ftplugin/latextoc.vim | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/ftplugin/latextoc.vim b/ftplugin/latextoc.vim index d5d7e58c..8edf23d1 100644 --- a/ftplugin/latextoc.vim +++ b/ftplugin/latextoc.vim @@ -76,9 +76,14 @@ function! s:TOCActivate(close) execute b:calling_win . 'wincmd w' + let root = fnamemodify(entry['file'], ':h') . '/' let files = [entry['file']] for line in filter(readfile(entry['file']), 'v:val =~ ''\\input{''') - call add(files, matchstr(line, '{\zs.*\ze\(\.tex\)\?}') . '.tex') + let file = matchstr(line, '{\zs.\{-}\ze\(\.tex\)\?}') . '.tex' + if file[0] != '/' + let file = root . file + endif + call add(files, file) endfor " Find section in buffer (or inputted files) |