Fix nvim-treesitter config: use explicit config fn instead of main

lazy.nvim's `main` shorthand resolves the module before the plugin is
fully loaded, causing 'nvim-treesitter.configs not found' on first run.
Explicit config function defers the require until setup time.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-22 10:52:36 -04:00
parent d4b7b6354d
commit fe673c846d

View File

@@ -258,8 +258,8 @@ require('lazy').setup({
{ {
'nvim-treesitter/nvim-treesitter', 'nvim-treesitter/nvim-treesitter',
build = ':TSUpdate', build = ':TSUpdate',
main = 'nvim-treesitter.configs', config = function()
opts = { require('nvim-treesitter.configs').setup({
ensure_installed = (function() ensure_installed = (function()
local t = { 'bash', 'json', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'vim', 'vimdoc', 'yaml' } local t = { 'bash', 'json', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'vim', 'vimdoc', 'yaml' }
vim.list_extend(t, _lang.parsers or {}) vim.list_extend(t, _lang.parsers or {})
@@ -268,7 +268,8 @@ require('lazy').setup({
auto_install = true, auto_install = true,
highlight = { enable = true }, highlight = { enable = true },
indent = { enable = true }, indent = { enable = true },
}, })
end,
}, },
-------------------------------------------------------------------------- --------------------------------------------------------------------------