From 97901b6342f125004de2bbf440bf37c822d84ed2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Yngve=20Lerv=C3=A5g?= Date: Fri, 10 May 2024 15:48:00 +0200 Subject: [PATCH] feat(qf): expand bst file paths refer: #2953 --- autoload/vimtex/qf/bibtex.vim | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/autoload/vimtex/qf/bibtex.vim b/autoload/vimtex/qf/bibtex.vim index ee8c7c8bd1..788958ad16 100644 --- a/autoload/vimtex/qf/bibtex.vim +++ b/autoload/vimtex/qf/bibtex.vim @@ -191,3 +191,21 @@ function! s:type_no_bibstyle.fix(ctx, entry) abort " {{{1 endfunction " }}}1 + +let s:type_fix_bst_path = {} +function! s:type_fix_bst_path.fix(ctx, entry) abort " {{{1 + let l:filename = has_key(a:entry, 'filename') + \ ? a:entry.filename + \ : has_key(a:entry, 'bufnr') + \ ? bufname(a:entry.bufnr) + \ : '' + if l:filename =~# '\.bst$' && !filereadable(l:filename) + let l:path = vimtex#kpsewhich#find(l:filename) + if filereadable(l:path) + let a:entry.filename = l:path + unlet! a:entry.bufnr + endif + endif +endfunction + +" }}}1