From df8eb97b667198954df98dd2b0a7b96d6e593ee9 Mon Sep 17 00:00:00 2001 From: Squibid Date: Sat, 9 Mar 2024 00:07:35 -0500 Subject: make treesitter disable on massive files, and diff files also remove auto installing --- after/plugin/ts.lua | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/after/plugin/ts.lua b/after/plugin/ts.lua index 59dea81..0494b3b 100644 --- a/after/plugin/ts.lua +++ b/after/plugin/ts.lua @@ -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 - }, + } } -- cgit v1.2.1