-
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 using Lazy.nvim causes problems with detecting the structure of the text inside a .tex file. #2698
Comments
This is problematic for example paired with the usage of snippets. Since it's just not "the color white/blue" what is annoying, but rather that the understanding of inside-which enviroment I am is wrong. If I am wrongfully inside bluetext, I trigger the local in_mathzone = function()
return vim.fn["vimtex#syntax#in_mathzone"]() == 1
end
local in_comment = function()
return vim.fn["vimtex#syntax#in_comment"]() == 1
end
local in_text = function()
return not in_mathzone() and not in_comment()
end |
Also, I'm loading Vimtex the following way in Lazy.nvim {
"lervag/vimtex",
config = function()
vim.cmd("call vimtex#init()")
end,
}, If I were not to do the |
You can easily check if VimTeX is lazily loaded with Lazy. Simply do
When I look at the little video you posted, I get a feeling that you are not actually using VimTeX for syntax highlighting. I may be wrong, but it is easy to check: Open a LaTeX file, move to the
Ah, no, this is very wrong! The {
"lervag/vimtex",
init = function()
vim.g.vimtex_options = "go here"
end,
}, I assume you are setting your VimTeX options elsewhere; you should move them to the init block as indicated above.
Well, that's not good. As mentioned above, that part is very wrong. You should update as I've explained then report back. |
It's very hard to debug this since I need to work on latex documents and I went back to using Packer with Lvim and Nvim 0.8.3. The "bad solution" was proposed in this github issue LunarVim/LunarVim#3723 |
I've added a comment in the issue thread you mentioned. |
I'm closing this issue, as it seems it should be resolved through LunarVim/LunarVim#3723. |
I saw this issue and was wondering what the correct way of configuring vimtex is using |
Yes, I think that is better. Setting the options in your personal Specifying the VimTeX configuration in the |
It seems LunarVim just merged a PR that should fix this issue: LunarVim/LunarVim#4124. |
Thank you so much for your help |
My pleasure, glad to se this is resolved! :) |
Description
Hello, I use LunarVim and recently there has been an update that switched from using Packer to Lazy as plugin managers. This seemed to cause problems with vimtex (as explained here, vimtex is not meant to be lazyloaded, but I'm not certain that such is the case right now).
The current problem I'm encountering is this, it's very hard to replicate (it's very inconsistent) but happens enough times to be really hard to work on
.tex
files. So for example with a simplealign*
enviroment. This should be used inside text and not in mathmode, soBut the inconsistencies are that, if I just copy and paste it, chances are that the text is not understood properly as that it should be in mathmode
But it's inconsistent, for example if I put $ $ around the enviroment (which is wrong) to trigger the text to be inside mathmode and then remove it I have this, which is more correct
The problem of discerning text from mathmode I believe happens mostly inside inline math
Here the text inside \text { } should be white, as it happens when it is inside displaymath.
I'm not 100% sure that the Vimtex + Lazy combo is causing the problem, so this issue is more to ask you where to start with debugging this (if that's not the case).
Steps to reproduce
No response
Expected behavior
No response
Actual behavior
No response
Do you use a latexmkrc file?
No
VimtexInfo
The text was updated successfully, but these errors were encountered: