diff --git a/nvim/lua/olinpin/plugins/treesitter.lua b/nvim/lua/olinpin/plugins/treesitter.lua index 22bcd66..337f9f9 100644 --- a/nvim/lua/olinpin/plugins/treesitter.lua +++ b/nvim/lua/olinpin/plugins/treesitter.lua @@ -3,7 +3,22 @@ return { lazy = false, build = ':TSUpdate', 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 vim.api.nvim_create_autocmd("FileType", { callback = function(args)