-
Notifications
You must be signed in to change notification settings - Fork 391
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VimTex compiles within symlink directory instead of base directory #2820
Comments
VimTeX does not automatically resolve the symlink and will use the source file's path as the active directory for compilation. I'm not going to change that, because some people rely on this as a feature. For example, some people use a shared "main" file across projects/notes and symlink it. When you open the symlink, things will work as expected because VimTeX does not resolve the symlink. Notice that this is also how tools like
DON'T lazy load VimTeX! Remove {
"lervag/vimtex",
init = function()
vim.g.vimtex_view_method = "sioyek"
vim.g.vimtex_view_sioyek_options = "--new-window"
vim.api.nvim_create_autocmd(
"VimtexEventQuit",
{ command = "VimtexClean" }
)
end,
} If you find
It seems this is what you want to do, but you need to apply this change before the FileType is specified. Perhaps the It seems to me, though, as your symlinks don't really have a useful purpose. Or, perhaps, I just don't understand the purpose.
The CWD for Vim is not necessarily the same as the CWD used by VimTeX for compilation. That is, VimTeX uses the main source file's path as the CWD during compilation - regardless of the CWD of Vim itself. |
In your steps to reproduce, could you make it more clear where your files are located? Are both |
Update: What you said about ignoring symlinks being a feature, not a bug, makes sense. I was also able to get the desired functionality by running |
Glad to hear that you've found a way that works for you!
If you find things to work as you want it to, then it seems safe to close the issue :) |
Description
For my math homework, I store the$\LaTeX$ source files in a git repo, and symlink them to my desktop for easy access. This is my VimTex config (for Lazy):
I have a function in my Neovim configuration that automatically opens symlinks in their base directory:
and I also have a custom template that I source with the following commands:
However, I noticed that if I open the symlink, rather than the full filename, VimTex compiles in my Desktop folder (i.e. the auxfiles appear in my desktop) and it therefore produces an error as the
templates/math
folder is in the git repo with my homework, not my desktop.This isn't a major bug, of course, so if there's not a trivial solution feel free to close the issue and I can live with it. Thank you!
Steps to reproduce
cd ~/Desktop
ln -s test/math.tex math.tex
vim math.tex
:VimtexCompile
Expected behavior
I would expect VimTex to compile in the base directory, not the symlink directory. Vim appears to be in the correct directory, as it (for example) provides tab completions for files in the proper git repo, not my desktop.
Actual behavior
VimTex compiles in my Desktop, and that's where it generates auxfiles. It's clear from
VimtexInfo
that it doesn't recognize the directory change, for some reason.Do you use a latexmkrc file?
No
VimtexInfo
The text was updated successfully, but these errors were encountered: