2026-03-15 13:14:09 +01:00

36 lines
1.3 KiB
Lua

return {
{ -- Highlight, edit, and navigate code
'nvim-treesitter/nvim-treesitter',
lazy = false,
build = ':TSUpdate',
branch = 'main',
-- [[ Configure Treesitter ]] See `:help nvim-treesitter-intro`
config = function()
local parsers = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }
require('nvim-treesitter').install(parsers)
vim.api.nvim_create_autocmd('FileType', {
callback = function(args)
local buf, filetype = args.buf, args.match
local language = vim.treesitter.language.get_lang(filetype)
if not language then return end
-- check if parser exists and load it
if not vim.treesitter.language.add(language) then return end
-- enables syntax highlighting and other treesitter features
vim.treesitter.start(buf, language)
-- enables treesitter based folds
-- for more info on folds see `:help folds`
-- vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
-- vim.wo.foldmethod = 'expr'
-- enables treesitter based indentation
vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
end,
})
end,
},
}
-- vim: ts=2 sts=2 sw=2 et