Skip to content

Bibtex citation completion requires full path of bib file #2184

@shreerammodi

Description

@shreerammodi

Description

When trying to complete citations with bibtex, I was running into errors when I simply included the file name of the bib file. My bib files are located in my texmf tree directory, and are found by kpsewhich. However, in order for citation completions to work in vimtex I need to use the full path of the bib file.

E.g. merely having \addbibresource{somefile.bib} does not make the citation completion menu appear when I press <C-x><C-o>, but I need to include the whole path, \addbibresource{~/Library/texmf/bibtex/bib/somefile.bib}.

Steps to reproduce

  1. nvim -u minimal.vim minimal.tex
  2. Uncomment out the first bib file option "\addbibresource{somefile.bib}"
  3. Go over to \cite{}
  4. Try to complete citations using <C-x><C-o>
Here is the `minimal.vim` file
set nocompatible
let &runtimepath  = '~/test/vimtex,' . &runtimepath
let &runtimepath .= ',~/test/vimtex/after'
filetype plugin indent on
syntax enable
" Add relevant options and VimTeX configuration below.
Here is the `minimal.tex`
\documentclass{minimal}
\usepackage{biblatex}

% \addbibresource{somefile.bib}
% \addbibresource{~/Library/texmf/bibtex/bib/somefile.bib}

\begin{document}

\cite{}

\end{document}

Expected behavior

The citation completion menu should pop up with all of the bibliography entries in somefile.bib

Actual behavior

There is no citation completion when using \addbibresource{somefile.bib}, but there is citation completion when using \addbibresource{~/Library/texmf/bibtex/bib/somefile.bib}.

However, compilation works on both versions without error and kpsewhich somefile.bib returns the location, the only issue is in completion.

Do you use a latexmkrc file?

No

VimtexInfo

System info
  OS: macOS 11.6 (20G165)
  Vim version: NVIM v0.6.0-dev+356-gbec7f47ce
  Has clientserver: true
  Servername: /var/folders/zh/j15t9snn5wdbyz3rh4gxj6t00000gn/T/nvimVMydBY/0

VimTeX project: minimal
  base: minimal.tex
  root: /Users/shreeram/test
  tex: /Users/shreeram/test/minimal.tex
  main parser: current file verified
  document class: minimal
  packages: bibtex
  compiler: latexmk
    engine: -xelatex
    options:
      -verbose
      -file-line-error
      -synctex=1
      -interaction=nonstopmode
    callback: 1
    continuous: 1
    executable: latexmk
  viewer: General
  qf method: LaTeX logfile

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions