Description
Inverse search validates that the target file is in b:vimtex.get_sources() before opening it. If vimtex's parser can't detect an included file (e.g., custom macros), inverse search silently fails even though SyncTeX correctly identifies the source.
Steps to reproduce
- Custom macro
% main.tex
\documentclass{report}
\begin{document}
Hello from main!
\newcommand{\mycommand}[2]{\section{#1}\input{#2.tex}}
\mycommand{Chapter A's title}{chapters/a}
\end{document}
% chapters/a.tex
Hello from a!
- Compile
- Verify SyncTeX knows about the file:
synctex edit -o "1:159:189:main.pdf"
# returns Input:chapters/a.tex
- Verify vimtex doesn't:
:echo b:vimtex.get_sources()
" ['main.tex']
- Try inverse search from PDF viewer on content from chapters/a.tex
Expected behavior
Trust SyncTeX data and navigate to the chapters/a.tex file
Actual behavior
Rejects valid inverse search if file isn't in vimtex's parsed list. Commenting out this line seems to resolve the issue.
Do you use a latexmkrc file?
No
VimtexInfo
System info:
OS: Arch Linux
LaTeX version: pdfTeX 3.141592653-2.6-1.40.28 (TeX Live 2025)
Vim version: NVIM v0.11.5
Has clientserver: true
Servername: /run/user/1000/nvim.400295.0
$PATH:
- /home/xxx/.local/bin
- /usr/bin
- /usr/bin/core_perl
- /usr/bin/site_perl
- /usr/bin/vendor_perl
- /usr/local/bin
- /usr/local/sbin
- /usr/local/texlive/2025/bin/x86_64-linux
VimTeX project: main
base: main.tex
root: /home/xxx/test
tex: /home/xxx/main.tex
main parser: current file verified
document class: report
document class options:
compiler: latexmk
engine: -pdf
options:
-verbose
-file-line-error
-synctex=1
-interaction=nonstopmode
out_dir: build
callback: 1
continuous: 1
executable: latexmk
viewer: sioyek
qf method: LaTeX logfile
Description
Inverse search validates that the target file is in
b:vimtex.get_sources()before opening it. If vimtex's parser can't detect an included file (e.g., custom macros), inverse search silently fails even though SyncTeX correctly identifies the source.Steps to reproduce
Expected behavior
Trust SyncTeX data and navigate to the
chapters/a.texfileActual behavior
Rejects valid inverse search if file isn't in vimtex's parsed list. Commenting out this line seems to resolve the issue.
Do you use a latexmkrc file?
No
VimtexInfo