mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-25 14:01:06 +00:00
fix(lazyfile): change logic to add syntax=ft instead of disabling the parser
This commit is contained in:
parent
75d20e2cc9
commit
56b8847c29
2 changed files with 4 additions and 4 deletions
|
|
@ -13,7 +13,7 @@ return {
|
||||||
if
|
if
|
||||||
vim.fn.argc() > 0 and vim.fn.isdirectory(vim.fn.argv(0) --[[@as string]]) ~= 1
|
vim.fn.argc() > 0 and vim.fn.isdirectory(vim.fn.argv(0) --[[@as string]]) ~= 1
|
||||||
then
|
then
|
||||||
vim.g.treesitter_disable_highlight = { "latex" }
|
vim.g.treesitter_syntax_legacy = { "latex" }
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
opts = function(_, opts)
|
opts = function(_, opts)
|
||||||
|
|
|
||||||
|
|
@ -86,12 +86,12 @@ function M.lazy_file()
|
||||||
if ft then
|
if ft then
|
||||||
-- Add treesitter highlights and fallback to syntax
|
-- Add treesitter highlights and fallback to syntax
|
||||||
local lang = vim.treesitter.language.get_lang(ft)
|
local lang = vim.treesitter.language.get_lang(ft)
|
||||||
if vim.tbl_contains(vim.g.treesitter_disable_highlight or {}, lang) then
|
|
||||||
lang = nil
|
|
||||||
end
|
|
||||||
if not (lang and pcall(vim.treesitter.start, event.buf, lang)) then
|
if not (lang and pcall(vim.treesitter.start, event.buf, lang)) then
|
||||||
vim.bo[event.buf].syntax = ft
|
vim.bo[event.buf].syntax = ft
|
||||||
end
|
end
|
||||||
|
if vim.tbl_contains(vim.g.treesitter_syntax_legacy or {}, lang) then
|
||||||
|
vim.bo[event.buf].syntax = ft
|
||||||
|
end
|
||||||
|
|
||||||
-- Trigger early redraw
|
-- Trigger early redraw
|
||||||
vim.cmd([[redraw]])
|
vim.cmd([[redraw]])
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue