summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lua/plugins/core/treesitter.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/lua/plugins/core/treesitter.lua b/lua/plugins/core/treesitter.lua
index 9aceffc..518f66b 100644
--- a/lua/plugins/core/treesitter.lua
+++ b/lua/plugins/core/treesitter.lua
@@ -32,6 +32,15 @@ return {
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
+ -- disable for big files
+ disable = function(_, buf)
+ local max_filesize = 100 * 1024 -- 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,
},
query_linter = {
enable = true,