mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
add used_by key to parsers
Enables the use of multiple filetypes for one parser.
This commit is contained in:
parent
a2f0931254
commit
7f6f7596da
3 changed files with 35 additions and 17 deletions
|
|
@ -17,9 +17,10 @@ function M.setup()
|
|||
for _, lang in pairs(parsers.available_parsers()) do
|
||||
for _, mod in pairs(configs.available_modules()) do
|
||||
if configs.is_enabled(mod, lang) then
|
||||
local ft = parsers.lang_to_ft(lang)
|
||||
local cmd = string.format("lua require'nvim-treesitter.%s'.attach()", mod)
|
||||
api.nvim_command(string.format("autocmd NvimTreesitter FileType %s %s", ft, cmd))
|
||||
for _, ft in pairs(parsers.lang_to_ft(lang)) do
|
||||
api.nvim_command(string.format("autocmd NvimTreesitter FileType %s %s", ft, cmd))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue