add used_by key to parsers

Enables the use of multiple filetypes for one parser.
This commit is contained in:
kiyan42 2020-06-29 14:46:25 +02:00 committed by Thomas Vigouroux
parent a2f0931254
commit 7f6f7596da
3 changed files with 35 additions and 17 deletions

View file

@ -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