treesitter.lua (1067B)
1 ---@diagnostic disable: undefined-global 2 return { 3 "nvim-treesitter/nvim-treesitter", 4 build = ":TSUpdate", 5 config = function() 6 require("nvim-treesitter").setup({ 7 -- ensure_installed = "none", 8 auto_install = true, 9 indent = { 10 enable = true 11 }, 12 highlight = { 13 enable = true, 14 disable = function(lang, buf) 15 local langs = { "latex", "html", "markdown", "text" } 16 for i = 1, #langs do 17 if lang == langs[i] then 18 return true 19 end 20 end 21 22 local max_filesize = 100 * 1024 -- 100 KB 23 local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf)) 24 if ok and stats and stats.size > max_filesize then 25 vim.notify( 26 "File larger than 100KB treesitter disabled for performance", 27 vim.log.levels.WARN, 28 { title = "Treesitter" } 29 ) 30 return true 31 end 32 end, 33 additional_vim_regex_highlighting = false, 34 }, 35 }) 36 end 37 38 }