lervag / vimtex

VimTeX: A modern Vim and neovim filetype plugin for LaTeX files.
MIT License
5.42k stars 389 forks source link

ToC: Regression: Opening vimtex-toc from bib file fails #594

Closed kiryph closed 7 years ago

kiryph commented 7 years ago

I get an error message when opening vimtex-toc from the bib file with a header line specifying the master tex file %! TEX root = demo.tex. The error message is

Error detected while processing function vimtex#toc#open[5]..vimtex#index#create:
line   19:
E121: Undefined variable: b:vimtex
E15: Invalid expression: b:vimtex
line   30:
E121: Undefined variable: l:vimtex
E15: Invalid expression: l:vimtex    

Minimal reproducible setup:

❯ tree mwe
mwe
├── demo.bib
└── demo.tex

0 directories, 2 files

~
❯ cat mwe/demo.bib
%! TEX root = demo.tex

 @article{lin1973,
    author  = {Shen Lin and Brian W. Kernighan},
    title   = {An Effective Heuristic Algorithm for the Travelling-Salesman Problem},
    journal = {Operations Research},
    volume  = {21},
    year    = {1973},
    pages   = {498--516},
 }

~
❯ cat mwe/demo.tex
\documentclass[]{article}

\begin{document}
\cite{lin1973}
\bibliographystyle{unsrt}
\bibliography{demo.bib}
\end{document}

Opening the toc from the tex file works

      Preamble
[b]   demo.bib                                          

But it does not work from the bib file anymore. I had submitted this as a feature request in issue #433.

lervag commented 7 years ago

The bug has been present since September 13, actually. Thanks for noticing, should be fixed now.