fix(tree-sitter): upgrade this mess to 0.12-compatible setup

This commit is contained in:
Oliver Ladner 2026-04-02 15:22:06 +02:00
commit 106c5e1b12
3 changed files with 91 additions and 81 deletions

View file

@ -1,5 +1,5 @@
{
"SchemaStore.nvim": { "branch": "main", "commit": "25a82a141dc0caf3b9b82002a35caf3c9feab741" },
"SchemaStore.nvim": { "branch": "main", "commit": "4f1c58a59d3a4da095743dd6f04b73caa0cefc3d" },
"aerial.nvim": { "branch": "master", "commit": "645d108a5242ec7b378cbe643eb6d04d4223f034" },
"blink-cmp-git": { "branch": "master", "commit": "10783593af764424018a95e75df6ad5a8b66fe07" },
"blink.cmp": { "branch": "main", "commit": "451168851e8e2466bc97ee3e026c3dcb9141ce07" },
@ -9,18 +9,17 @@
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
"flash.nvim": { "branch": "main", "commit": "fcea7ff883235d9024dc41e638f164a450c14ca2" },
"friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" },
"fzf-lua": { "branch": "main", "commit": "bde73a6886b607246095aa59f396de5e0d036890" },
"gitsigns.nvim": { "branch": "main", "commit": "a462f416e2ce4744531c6256252dee99a7d34a83" },
"fzf-lua": { "branch": "main", "commit": "c9e7b7bfbd01f949164988ee1684035468e1995c" },
"gitsigns.nvim": { "branch": "main", "commit": "e1b90b60fb7aa9c0ada8e983b460764b35a05e2e" },
"kanso.nvim": { "branch": "main", "commit": "1afbbb449aa0254823dbe1932e3cbb51886ff9fe" },
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
"lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" },
"lush.nvim": { "branch": "main", "commit": "9c60ec2279d62487d942ce095e49006af28eed6e" },
"mason.nvim": { "branch": "main", "commit": "44d1e90e1f66e077268191e3ee9d2ac97cc18e65" },
"mini.nvim": { "branch": "main", "commit": "439cdcd6992bc9012efd7d8ed7a7b7a0f1fac32a" },
"mini.nvim": { "branch": "main", "commit": "3923662bf3d6ca49a9503f8d7196ea0450983e6a" },
"nvim-lint": { "branch": "master", "commit": "4b03656c09c1561f89b6aa0665c15d292ba9499d" },
"nvim-treesitter": { "branch": "master", "commit": "cf12346a3414fa1b06af75c79faebe7f76df080a" },
"nvim-treesitter-context": { "branch": "master", "commit": "adf4b6b0420b7be6c717ef0ac7993183d6c201b1" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "5ca4aaa6efdcc59be46b95a3e876300cfead05ef" },
"nvim-treesitter": { "branch": "main", "commit": "c82bf96f0a773d85304feeb695e1e23b2207ac35" },
"nvim-treesitter-context": { "branch": "master", "commit": "b0c45cefe2c8f7b55fc46f34e563bc428ef99636" },
"nvim-treesitter-textobjects": { "branch": "main", "commit": "93d60a475f0b08a8eceb99255863977d3a25f310" },
"nvim-web-devicons": { "branch": "master", "commit": "d7462543c9e366c0d196c7f67a945eaaf5d99414" },
"oil.nvim": { "branch": "master", "commit": "0fcc83805ad11cf714a949c98c605ed717e0b83e" },
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
@ -31,6 +30,5 @@
"telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
"todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" },
"trouble.nvim": { "branch": "main", "commit": "bd67efe408d4816e25e8491cc5ad4088e708a69a" },
"which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" },
"zenbones.nvim": { "branch": "main", "commit": "22b7fb75593412e0dc81b4bdefae718e9e84aa82" }
"which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" }
}

View file

@ -7,7 +7,16 @@ return {
-- require("mini.ai").setup({ n_lines = 500 })
require("mini.trailspace").setup() -- highlight trailing space
require("mini.cursorword").setup() -- highlight word below cursor
require("mini.ai").setup() -- replace within/outside quotes
require("mini.ai").setup({ -- replace within/outside quotes
mappings = {
-- Disable next/last variants to avoid conflict with
-- Neovim 0.12 built-in `an`/`in` node selection (see :help v_an)
around_next = "",
inside_next = "",
around_last = "",
inside_last = "",
},
})
require("mini.pick").setup({
mappings = {
move_down = "<C-j>",

View file

@ -1,74 +1,77 @@
-- Treesitter
-- NOTE: After updating, wipe old plugin cache then reinstall:
-- rm -rf ~/.local/share/nvim/lazy/nvim-treesitter
-- rm -rf ~/.local/share/nvim/lazy/nvim-treesitter-textobjects
-- Then open Neovim and run :Lazy restore
return {
"nvim-treesitter/nvim-treesitter",
branch = "master", -- FIXME: switch to main sometime
lazy = false,
build = ":TSUpdate",
event = { "BufReadPre", "BufNewFile" },
enabled = true,
dependencies = {
"nvim-treesitter/nvim-treesitter-textobjects",
},
config = function()
local treesitter = require("nvim-treesitter.configs")
{
"nvim-treesitter/nvim-treesitter",
branch = "main",
lazy = false,
build = ":TSUpdate",
enabled = true,
config = function()
require("nvim-treesitter")
.install({
"lua",
"comment", -- used for TODO:, FIXME:, XXX: and NOTE:
"vim",
"vimdoc",
"bash",
"diff",
"make",
"gitignore",
"gitcommit",
"markdown",
"markdown_inline",
"rst",
"latex",
"elixir",
"eex",
"heex",
"yaml",
"html",
"css",
"javascript",
"dockerfile",
"query",
"hcl",
"terraform",
"bicep",
"csv",
"properties",
"ini",
"python",
"regex",
"json",
"go",
"gomod",
"gosum",
"editorconfig",
"http",
"toml",
"sql",
"promql",
"nginx",
"powershell",
})
:wait(300000) -- wait max. 5 min
treesitter.setup({
highlight = { enable = true },
indent = { enable = true },
auto_install = false,
-- language list: https://github.com/nvim-treesitter/nvim-treesitter#supported-languages
ensure_installed = {
"lua",
"comment", -- used for TODO:, FIXME:, XXX: and NOTE:
"vim",
"vimdoc",
"bash",
"diff",
"make",
"gitignore",
"gitcommit",
"markdown",
"markdown_inline",
"rst",
"latex",
"elixir",
"eex",
"heex",
"yaml",
"html",
"css",
"javascript",
"dockerfile",
"query",
"hcl",
"terraform",
"bicep",
"csv",
"properties",
"ini",
"python",
"regex",
"json",
"go",
"gomod",
"gosum",
"editorconfig",
"http",
"toml",
"sql",
"promql",
"nginx",
"powershell",
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = "<C-s>",
node_incremental = "<C-s>",
scope_incremental = false,
node_decremental = "<bs>",
},
},
})
end,
-- Highlight & indent are built into Neovim 0.11+
vim.api.nvim_create_autocmd("FileType", {
callback = function()
if pcall(vim.treesitter.start) then
vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
end
end,
})
-- Incremental node selection (Neovim 0.12+, see :help v_an v_in)
-- Built-in: an = expand to parent, in = shrink to child
-- mini.ai's `an`/`in` next/last mappings must be disabled (see mini.lua)
vim.keymap.set("n", "<C-s>", "van", { desc = "Treesitter: init selection", remap = true })
vim.keymap.set("v", "<C-s>", "an", { desc = "Treesitter: expand selection", remap = true })
vim.keymap.set("v", "<bs>", "in", { desc = "Treesitter: shrink selection", remap = true })
end,
},
}