Merge upstream: Attach treesitter using language name instead of filetype

This commit is contained in:
Damjan 9000 2026-03-15 13:13:50 +01:00
commit b4b8219215

View File

@ -1,12 +1,21 @@
return {
{ -- Highlight, edit, and navigate code
'nvim-treesitter/nvim-treesitter',
lazy = false,
build = ':TSUpdate',
branch = 'main',
config = function()
local filetypes = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }
require('nvim-treesitter').install(filetypes)
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', {
pattern = filetypes,
callback = function() vim.treesitter.start() end,
callback = function(args)
local buf, filetype = args.buf, args.match
local language = vim.treesitter.language.get_lang(filetype)
if not vim.tbl_contains(parsers, language) then return end
vim.treesitter.start()
end,
})
end,
},