SexNvim/lua/config/nvim-treesitter.lua
2025-04-10 22:48:33 +03:00

28 lines
957 B
Lua
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

require'nvim-treesitter.configs'.setup {
highlight = {
enable = true,
disable = function(lang, buf)
-- Проверяем, существует ли буфер и связан ли он с файлом
if not buf or buf == 0 then
return true
end
-- Получаем информацию о файле
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
if not ok or not stats or not stats.size then
return true
end
-- Отключаем подсветку для больших файлов
local max_filesize = 500 * 1024 -- 500 KB
if stats.size > max_filesize then
return true
end
-- Включаем подсветку для всех остальных случаев
return false
end,
},
}