latexneovimneovim-plugin

Neovim/Vimtex: Can't open file with empty name


The past week I have been trying to set up NVIM for some personal stuff from scratch and got it working to the point that I can use it for web development comfortably. As I soon want to write my Bachelor's Thesis I also thought about setting it up for LaTeX, but this is where I've hit my first blocker.

The test file I am trying to compile is also nothing fancy:

\documentclass{article}
\title{"Test Document"}
\author{"Your Name"}
\date{\today}

\begin{document}
\maketitle

\section{Introduction}
This is a test document created for testing VimTeX functionality.

\section{Mathematics}
Here is an equation: $E=mc^2$.

\section{Lists}
\begin{itemize}
  \item Item 1
  \item Item 2
  \item Item 3
\end{itemize}

\section{Conclusion}
Testing complete. This is the end of the document.

\end{document}

So I'd argue this is not the problem either. I have tried using different files, with different names in different location to exclude permission hick ups etc. I can't find anything upon googling this error. I'm using lazy.nvim as a plugin manager and it seems to load just fine.

Compiling .tex files in terminal with latexmk works, but in my nvim upon running :VimtexCompile it simply says E482: Can't open file with an empty name. The most confusing part of it all is that LazyVim (the distro) gets the same error BUT still compiles it somehow. Upon running :VimtexInfo I get:

System info:
  OS: macOS 14.2 (23C64)
  Vim version: NVIM v0.9.4
  Has clientserver: true
  Servername: undefined (vim started without --servername)

VimTeX project: main
  base: main.tex
  root: /Users/paul/Development/tmp/Playground/Latex/vimtex
  tex: /Users/paul/Development/tmp/Playground/Latex/vimtex/main.tex
  main parser: current file verified
  document class: article
  compiler: latexmk
    engine: -pdf
    options:
      -verbose
      -file-line-error
      -synctex=1
      -interaction=nonstopmode
    callback: 1
    continuous: 1
    executable: latexmk
  viewer: General
  qf method: LaTeX logfile

so it seems to recognize it.

My vimtex.lua:

return {
    "lervag/vimtex",
    lazy = false, -- lazy-loading will disable inverse search
}

If any information necessary to help me here is still missing, please let me know and I'll add it.

Does anybody have an idea how I could fix this?

Edit

The complete error is

Error detected while processing function vimtex#compiler#compile[6]..vimtex#compiler#start[17]..53:
line    6:
E482: Can't open file with an empty name

Edit 2

:echo tempname() does not output anything. Maybe this has something to do with it?


Solution

  • Solution

    The error came from calling neovim with the environment variable NVIM_APPNAME, for some reason this resulted in :echo tempname() to output nothing. When putting everything in the .config directory directly, it worked. I still don't know why LazyVim was still able to compile it, but at least I can compile now.