return { 'nvim-treesitter/nvim-treesitter', -- branch = 'main', -- This is the default now lazy = false, config = function() -- 1. Install Parsers require('nvim-treesitter').install({ "typst", "cpp", "c", "lua", "vim", "dockerfile", "python", "java", "cmake", "diff", "gitcommit", "html", "css", "javascript", "json", "rust", "sql", "yaml", "markdown", "markdown_inline", "nix", "bibtex" }) -- 2. Enable Highlighting via Autocmd vim.api.nvim_create_autocmd('FileType', { callback = function(args) -- Disable logic (ini, markdown, or large files) local ft = vim.bo[args.buf].filetype if ft == "ini" or ft == "markdown" then return end local max_filesize = 2000 * 1024 -- 2MB local ok, stats = pcall(vim.uv.fs_stat, vim.api.nvim_buf_get_name(args.buf)) if ok and stats and stats.size > max_filesize then return end -- Enable highlighting vim.treesitter.start() end, }) -- 3. Enable Indentation vim.api.nvim_create_autocmd('FileType', { pattern = '*', callback = function() vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()" end }) end, }