diff options
author | Squibid <me@zacharyscheiman.com> | 2024-03-09 00:07:35 -0500 |
---|---|---|
committer | Squibid <me@zacharyscheiman.com> | 2024-03-09 00:08:19 -0500 |
commit | df8eb97b667198954df98dd2b0a7b96d6e593ee9 (patch) | |
tree | 9d6ea6bfa1a36a5fcbc119fd4ace6d9c3a296156 | |
parent | 3dc9b652c3377744f3f511e6824bc63d36b142c6 (diff) | |
download | nvim-df8eb97b667198954df98dd2b0a7b96d6e593ee9.tar.gz nvim-df8eb97b667198954df98dd2b0a7b96d6e593ee9.tar.bz2 nvim-df8eb97b667198954df98dd2b0a7b96d6e593ee9.zip |
make treesitter disable on massive files, and diff files
also remove auto installing
Diffstat (limited to '')
-rw-r--r-- | after/plugin/ts.lua | 12 |
1 files 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 - }, + } } |