This commit is contained in:
2025-04-10 22:48:33 +03:00
parent dde7d87052
commit 73175fd40c
5 changed files with 97 additions and 12 deletions

View File

@ -1,5 +1,27 @@
require'nvim-treesitter.configs'.setup {
ensure_installed = { "markdown", "bash", "markdown_inline", "lua", "python", "javascript", "html", "css", "c", "cpp", "rust" },
highlight = { enable = true },
indent = { enable = true }
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,
},
}