refactor(plugins)!: plugins now use lazy.nvim's new opts property to make it far easier to override options

This commit is contained in:
Folke Lemaitre 2023-01-08 15:05:34 +01:00
parent 8667b3d54e
commit 2135bc144c
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
8 changed files with 140 additions and 95 deletions

View file

@ -3,31 +3,36 @@ return {
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
event = "BufReadPost",
ensure_installed = {
"bash",
"help",
"html",
"javascript",
"json",
"lua",
"markdown",
"markdown_inline",
"python",
"query",
"regex",
"tsx",
"typescript",
"vim",
"yaml",
---@type TSConfig
opts = {
sync_install = false,
highlight = { enable = true },
indent = { enable = true },
context_commentstring = { enable = true, enable_autocmd = false },
ensure_installed = {
"bash",
"help",
"html",
"javascript",
"json",
"lua",
"markdown",
"markdown_inline",
"python",
"query",
"regex",
"tsx",
"typescript",
"vim",
"yaml",
},
},
config = function(plugin)
require("nvim-treesitter.configs").setup({
sync_install = false,
ensure_installed = plugin.ensure_installed,
highlight = { enable = true },
indent = { enable = true },
context_commentstring = { enable = true, enable_autocmd = false },
})
---@param opts TSConfig
config = function(plugin, opts)
if plugin.ensure_installed then
require("lazyvim.util").deprecate("treesitter.ensure_installed", "treesitter.opts.ensure_installed")
end
require("nvim-treesitter.configs").setup(opts)
end,
},
}