From 69524bf589cad29dada682bbc1b94f3db6a4374e Mon Sep 17 00:00:00 2001 From: rootiest Date: Fri, 4 Oct 2024 14:01:06 -0400 Subject: [PATCH] perf: set special options for treesitter --- lua/data/types.lua | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lua/data/types.lua b/lua/data/types.lua index c2d7663..85bda75 100644 --- a/lua/data/types.lua +++ b/lua/data/types.lua @@ -1594,8 +1594,25 @@ M.toggleterm = { }, } +M.ts = { disabled_highlights = { "text" } } + +local no_highlight = M.ts.disabled_highlights + M.treesitter = { opts = { + highlight = { + disable = function(lang, buf) + if vim.tbl_contains(no_highlight, lang) then + return true + end + local max_filesize = 1000 * 1024 -- 1 MB + local ok, stats = pcall(vim.uv.fs_stat, vim.api.nvim_buf_get_name(buf)) + if ok and stats and stats.size > max_filesize then + return true + end + end, + }, + auto_install = true, ensure_installed = { "bash", "c", @@ -1615,6 +1632,7 @@ M.treesitter = { "python", "query", "regex", + "ssh_config", "toml", "tsx", "typescript",