-- lua/config/nvim-treesitter.lua require('nvim-treesitter').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, }, -- Дополнительно можно включить другие функции: -- indent = { enable = true }, -- incremental_selection = { enable = true }, -- textobjects = { ... }, })