fix(nvim): refactor treesitter to explicit parser list with deferred install

This commit is contained in:
Oliver
2026-03-13 15:10:27 +01:00
parent 4e0f21a398
commit 4d6b854f4d

View File

@@ -3,7 +3,22 @@ return {
lazy = false, lazy = false,
build = ':TSUpdate', build = ':TSUpdate',
config = function() config = function()
-- New nvim-treesitter just installs parsers, Neovim handles highlighting local ensure_installed = {
"lua", "vim", "vimdoc", "javascript", "typescript", "tsx",
"html", "css", "json", "yaml", "markdown", "bash", "python",
"php", "vue", "dockerfile", "go", "rust",
}
-- Auto-install missing parsers
vim.defer_fn(function()
for _, lang in ipairs(ensure_installed) do
local ok = pcall(vim.treesitter.language.inspect, lang)
if not ok then
vim.cmd("TSInstall " .. lang)
end
end
end, 100)
-- Start treesitter highlighting for all buffers with a parser -- Start treesitter highlighting for all buffers with a parser
vim.api.nvim_create_autocmd("FileType", { vim.api.nvim_create_autocmd("FileType", {
callback = function(args) callback = function(args)