Skip to content

Commit d19491d

Browse files
committed
feat!: Use treesitter main branch
1 parent b43603b commit d19491d

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

lua/vnext/plugins/treesitter.lua

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
return {
22
"nvim-treesitter/nvim-treesitter",
3-
-- TODO: master is deprecated but treesitter-endwise does not work with main branch
4-
branch = "master",
3+
branch = "main",
54
build = ":TSUpdate",
65
event = { "BufReadPost", "BufNewFile" },
6+
cmd = { "TSUpdate", "TSInstall", "TSLog", "TSUninstall" },
77
opts = {
8+
indent = { enable = true },
9+
highlight = { enable = true },
10+
folds = { enable = true },
11+
endwise = { enable = true },
812
ensure_installed = {
913
"bash",
1014
"bicep",
@@ -35,23 +39,19 @@ return {
3539
},
3640
dependencies = {
3741
"RRethy/nvim-treesitter-endwise", -- mainly for Lua 'closing end' insertion
38-
{ "nvim-mini/mini.ai", event = { "BufReadPre", "BufNewFile" }, opts = {} },
39-
-- "windwp/nvim-ts-autotag",
42+
{ "nvim-mini/mini.ai", event = { "BufReadPre", "BufNewFile" }, opts = {} }, -- for q (quotes), b (brackets), t (tags)
4043
},
4144
config = function(_, opts)
42-
---@diagnostic disable-next-line: missing-fields
43-
require("nvim-treesitter.configs").setup({
44-
ensure_installed = opts.ensure_installed,
45-
highlight = {
46-
enable = true,
47-
},
48-
endwise = {
49-
enable = true,
50-
},
51-
indent = { enable = true },
52-
autopairs = { enable = true },
53-
})
45+
local ts = require("nvim-treesitter")
46+
47+
for _, parser in ipairs(opts.ensure_installed) do
48+
pcall(ts.install, parser)
49+
end
5450

55-
-- require("nvim-ts-autotag").setup()
51+
vim.api.nvim_create_autocmd("FileType", {
52+
callback = function()
53+
pcall(vim.treesitter.start)
54+
end,
55+
})
5656
end,
5757
}

0 commit comments

Comments
 (0)