2023-05-13 02:55:45 +00:00
|
|
|
-- since `vim.tbl_deep_extend`, can only merge tables and not lists, the code above
|
|
|
|
-- would overwrite `ensure_installed` with the new value.
|
|
|
|
-- If you'd rather extend the default config, use the code below instead:
|
|
|
|
return {
|
|
|
|
{
|
|
|
|
"nvim-treesitter/nvim-treesitter",
|
|
|
|
opts = function(_, opts)
|
|
|
|
vim.list_extend(opts.ensure_installed, {
|
|
|
|
"rust",
|
|
|
|
})
|
|
|
|
end,
|
2023-11-07 09:29:53 +00:00
|
|
|
config = function(_, opts)
|
|
|
|
if type(opts.ensure_installed) == "table" then
|
|
|
|
---@type table<string, boolean>
|
|
|
|
local added = {}
|
|
|
|
opts.ensure_installed = vim.tbl_filter(function(lang)
|
|
|
|
if added[lang] then
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
added[lang] = true
|
|
|
|
return true
|
|
|
|
end, opts.ensure_installed)
|
|
|
|
end
|
|
|
|
require("nvim-treesitter.configs").setup(opts)
|
|
|
|
|
|
|
|
local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
|
|
|
|
|
|
|
|
parser_config.nu = {
|
|
|
|
install_info = {
|
|
|
|
url = "https://github.com/nushell/tree-sitter-nu",
|
|
|
|
files = { "src/parser.c" },
|
|
|
|
branch = "main",
|
|
|
|
},
|
|
|
|
filetype = "nu",
|
|
|
|
}
|
|
|
|
end,
|
2023-05-13 02:55:45 +00:00
|
|
|
},
|
2023-05-13 03:44:48 +00:00
|
|
|
{
|
|
|
|
"nvim-treesitter/playground",
|
|
|
|
dependencies = { "nvim-treesitter/nvim-treesitter" },
|
|
|
|
cmd = "TSPlaygroundToggle",
|
|
|
|
},
|
2023-05-13 02:55:45 +00:00
|
|
|
}
|