fix: small improvements
This commit is contained in:
+15
-4
@@ -9,6 +9,8 @@ end)
|
||||
|
||||
-- Treesitter
|
||||
Config.now_if_args(function()
|
||||
vim.treesitter.language.register('bash', 'sh')
|
||||
vim.treesitter.language.register('tsx', 'typescriptreact')
|
||||
|
||||
local filetypes = {
|
||||
'html', 'css', 'lua', 'go', 'php', 'blade', 'sql', 'javascript',
|
||||
@@ -23,10 +25,19 @@ Config.now_if_args(function()
|
||||
end, 'Start tree-sitter')
|
||||
|
||||
Config.later(function()
|
||||
vim.pack.add({ 'https://github.com/nvim-treesitter/nvim-treesitter' })
|
||||
require('nvim-treesitter').install(vim.tbl_map(function(ft)
|
||||
return vim.treesitter.language.get_lang(ft) or ft
|
||||
end, filetypes))
|
||||
local missing = {}
|
||||
|
||||
for _, ft in ipairs(filetypes) do
|
||||
local lang = vim.treesitter.language.get_lang(ft) or ft
|
||||
if #vim.api.nvim_get_runtime_file('parser/' .. lang .. '.so', false) == 0 then
|
||||
table.insert(missing, lang)
|
||||
end
|
||||
end
|
||||
|
||||
if #missing > 0 then
|
||||
vim.pack.add({ 'https://github.com/nvim-treesitter/nvim-treesitter' })
|
||||
require('nvim-treesitter').install(missing)
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user