Closed mvds314 closed 1 year ago
add event="VeryLazy" for vimtex plugin
Tried it like so: { "lervag/vimtex", ft = "tex", event="VeryLazy"},
But it does not solve the problem. Syntax highlighting still looks like this (intially): After I switch theme (manually), it looks like this: Meaning the onedark theme, as all other files look.
@mvds314 share your settings + a test latex file
https://github.com/NvChad/base46/assets/59060246/09197973-7c79-4b7a-ae55-b1225aafb279
i cant reproduce this issue, also treesitter latex treesitter parser seems to provide nice highlighting, then why use vimtex?
Let me check on my Linux machine later today.
Treesitter doesn't seem be doing a good job for LaTeX. I'm not sure why, but others complain about it too. So, my first though was to turn treesitter off for for tex files and use vimtex (as I need to install that anyway), maybe there are other solutions too.
The issue persist on my Linux machine.
Steps I followed:
I believe I fixed it. Not sure why, but my guess is my custom config was overriding the standard treesitter config.
And, I should have added the line: dofile(vim.g.base46_cache .. "syntax")
So that the entire config for treesitter now looks like this:
{
"nvim-treesitter/nvim-treesitter",
opts = {
ensure_installed = { "html", "css", "bash", "python", "latex", "json", "lua", "vim", "yaml" },
},
config = function(_, opts)
-- https://www.reddit.com/r/neovim/comments/xqogsu/turning_off_treesitter_and_lsp_for_specific_files/
dofile(vim.g.base46_cache .. "syntax")
require("nvim-treesitter.configs").setup {
highlight = {
enable = true, -- false will disable the whole extension
disable = { "tex", "latex" }, -- list of language that will be disabled
use_languagetree = true,
},
indent = { enable = true },
}
end,
},
yes @mvds314 the dofile code is in the default config too
Describe the bug I want to use vimtex for syntax highlighting LaTeX, as people claim it is better that treesitter this filetype.
When I open neovim, and open a LaTeX file right away, the highlighting color do no match the NvChad theme (onedark in my case), but resembes one of the vim default themes (not sure which one).
To Reproduce Steps to reproduce the behavior:
Install vimtex, set up NvChad with any theme (onedark)
Disable treesitter for latex like so: { "nvim-treesitter/nvim-treesitter", opts = { ensureinstalled = { "html", "css", "bash", "python", "latex", "json", "lua", "vim", "yaml" }, }, config = function(, opts) -- https://www.reddit.com/r/neovim/comments/xqogsu/turning_off_treesitter_and_lsp_for_specific_files/ require "nvim-treesitter.configs".setup { highlight = { enable = true, -- false will disable the whole extension disable = { "tex", "latex" }, -- list of language that will be disabled use_languagetree = true, }, } end, },
Open neovim
open a Latex file, syntax highlighting does not look good (it resembles one of the vim default themes, not sure which one).
Then switch (leader+t+h) to the selected theme of NvChad
Expected behavior Step 6 should not be required
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):