mirror of
https://github.com/nvim-lua/kickstart.nvim.git
synced 2026-03-30 01:31:30 +00:00
Attach treesitter using language name instead of filetype
This commit is contained in:
parent
966d5e94b1
commit
a6dcf6874b
17
init.lua
17
init.lua
@ -879,12 +879,21 @@ require('lazy').setup({
|
||||
|
||||
{ -- 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,
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user