make treesitter disable on massive files, and diff files

also remove auto installing
This commit is contained in:
2024-03-09 00:07:35 -05:00
parent 3dc9b652c3
commit df8eb97b66

View File

@ -18,13 +18,19 @@ treesitter.setup {
"git_config",
},
auto_install = true,
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
disable = function(lang, buf)
if lang == "diff" then return true end
local max_filesize = 1024 * 100 -- 100 KB
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
if ok and stats and stats.size > max_filesize then
return true
end
end
},
indent = {
enable = true
},
}
}