-- ── plugins/treesitter.lua ──────────────────────────────────────────────────── -- nvim-treesitter rewrote its API (Oct 2025). -- - nvim-treesitter.configs is GONE -- - New API: require("nvim-treesitter").setup{} -- - Does NOT support lazy loading: lazy = false required -- - treesitter-textobjects is now a fully separate module return { -- ── Core treesitter ─────────────────────────────────────────────────────── { "nvim-treesitter/nvim-treesitter", branch = "main", lazy = false, build = ":TSUpdate", config = function() require("nvim-treesitter").setup({ ensure_installed = { "python", "bash", "lua", "luadoc", "json", "yaml", "toml", "markdown", "markdown_inline", "regex", "vim", "vimdoc", "diff", "gitcommit", "git_rebase", "ini", "comment", }, auto_install = false, -- stateless image, no runtime installs }) -- Highlight: enable per filetype via autocmd (new API pattern) vim.api.nvim_create_autocmd("FileType", { callback = function(ev) -- Skip very large files local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(ev.buf)) if ok and stats and stats.size > 500 * 1024 then return end pcall(vim.treesitter.start) end, }) end, }, -- ── Textobjects: separate plugin, separate module ───────────────────────── { "nvim-treesitter/nvim-treesitter-textobjects", branch = "main", lazy = false, dependencies = { { "nvim-treesitter/nvim-treesitter", branch = "main" }, }, config = function() require("nvim-treesitter-textobjects").setup({ select = { enable = true, lookahead = true, keymaps = { ["af"] = "@function.outer", ["if"] = "@function.inner", ["ac"] = "@class.outer", ["ic"] = "@class.inner", ["aa"] = "@parameter.outer", ["ia"] = "@parameter.inner", ["ab"] = "@block.outer", ["ib"] = "@block.inner", }, }, move = { enable = true, set_jumps = true, goto_next_start = { ["]f"] = "@function.outer", ["]c"] = "@class.outer", }, goto_previous_start = { ["[f"] = "@function.outer", ["[c"] = "@class.outer", }, }, }) end, }, }