diff options
Diffstat (limited to 'nvim/lua/plugins/treesitter.lua')
| -rw-r--r-- | nvim/lua/plugins/treesitter.lua | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/nvim/lua/plugins/treesitter.lua b/nvim/lua/plugins/treesitter.lua index a218e13..2f0f654 100644 --- a/nvim/lua/plugins/treesitter.lua +++ b/nvim/lua/plugins/treesitter.lua @@ -1,12 +1,34 @@ return { 'nvim-treesitter/nvim-treesitter', - build = ':TSUpdate', - opts = { - ensure_installed = { "help", "lua", "python", "javascript", "typescript", "c", "latex", "vim", "go" }, - auto_install = true, - highlight = { - enable = true, - additional_vim_regex_highlighting = false + lazy = false, + build = function() + local nvim_treesitter = require("nvim-treesitter") + local util = require("nvim.lua.shared") + + local installed = util.to_set(nvim_treesitter.get_installed()) + local ensure_installed = util.to_set { + "markdown", "markdown_inline", + "vimdoc", + "c", + "make", + "rust", + "go", "gowork", "gotmpl", + "json", "yaml", "toml", + "python", + "html", + "javascript", + "julia", "r", + "bash", + "latex", + "sql", } - } + + local diff = util.set_difference(ensure_installed, installed) + if #diff > 0 then + -- NOTE: potential race condition because install is async + nvim_treesitter.install(util.keys(diff)) + end + + nvim_treesitter.update({ summary = true }) + end, } |
