summaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
authorChristian Segundo2024-04-04 00:03:07 +0200
committerChristian Segundo2024-04-04 00:03:07 +0200
commit10482c419b663004a474b05caaa6b4e2a274c025 (patch)
tree09e7e6bdded4464763b04b2ed8d3ae5e3f4bb087 /lua
parentf0db38feb747e7d57185033d6bb203eb95f420a7 (diff)
downloadconfig-10482c419b663004a474b05caaa6b4e2a274c025.tar.gz
disable ts on big files
Diffstat (limited to 'lua')
-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,