过去一周,我一直在尝试从头开始为一些个人东西设置 NVIM,并让它工作到我可以轻松地使用它进行 Web 开发的程度。因为我很快就想写我的学士论文,所以我也考虑过将其设置为 LaTeX,但这就是我遇到的第一个障碍。
我尝试编译的测试文件也没什么奇特的:
\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}
所以我认为这也不是问题。我尝试使用不同的文件,在不同的位置使用不同的名称来排除权限问题等。在谷歌搜索此错误时我找不到任何内容。我使用lazy.nvim作为插件管理器,它似乎加载得很好。
使用
.tex
在终端中编译 latexmk
文件可以工作,但在我的 nvim 中运行 :VimtexCompile
时,它只是显示 E482: Can't open file with an empty name
。最令人困惑的部分是 LazyVim(发行版)遇到相同的错误,但仍然以某种方式编译它。运行后:VimtexInfo
我得到:
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
所以它似乎认出了它。
我的
vimtex.lua
:
return {
"lervag/vimtex",
lazy = false, -- lazy-loading will disable inverse search
}
如果仍然缺少帮助我的任何必要信息,请告诉我,我会添加它。
有人知道我该如何解决这个问题吗?
完整的错误是
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
:echo tempname()
不输出任何内容。也许和这个有关系?
错误来自于使用环境变量
NVIM_APPNAME
调用neovim,由于某种原因,这导致:echo tempname()
不输出任何内容。当直接将所有内容放入 .config
目录中时,它起作用了。我还是不知道为什么 LazyVim 还能编译,但至少我现在可以编译了。