mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-21 12:50:09 -04:00
feat(config): add global disable option
This commit is contained in:
parent
627a1e558f
commit
c3e6369db6
3 changed files with 10 additions and 3 deletions
|
|
@ -83,6 +83,7 @@ so you'll need to activate them by putting this in your `init.vim` file:
|
|||
lua <<EOF
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
ensure_installed = "all" -- one of "all", "language", or a list of languages
|
||||
disable = {"markdown"}, -- a list of languages to disable for all modules (only enable manually)
|
||||
highlight = {
|
||||
enable = true, -- false will disable the whole extension
|
||||
disable = { "c", "rust" }, -- list of language that will be disabled
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ To enable supported features, put this in your `init.vim` file:
|
|||
lua <<EOF
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
ensure_installed = "all" -- one of "all", "language", or a list of languages
|
||||
disable = {"markdown"}, -- a list of languages to disable for all modules (only enable manually)
|
||||
highlight = {
|
||||
enable = true, -- false will disable the whole extension
|
||||
disable = { "c", "rust" }, -- list of language that will be disabled
|
||||
|
|
|
|||
|
|
@ -300,17 +300,22 @@ function M.setup(user_data)
|
|||
config.ensure_installed = data
|
||||
require'nvim-treesitter.install'.ensure_installed(data)
|
||||
else
|
||||
data.disable = data.disable or {}
|
||||
for _, lang in ipairs(user_data.disable or {}) do
|
||||
if not vim.tbl_contains(data.disable, lang) then
|
||||
table.insert(data.disable, lang)
|
||||
end
|
||||
end
|
||||
config.modules[name] = vim.tbl_deep_extend('force', config.modules[name] or {}, data)
|
||||
|
||||
recurse_modules(function(_, _, new_path)
|
||||
if data.enable then
|
||||
enable_all(new_path)
|
||||
end
|
||||
|
||||
for _, lang in ipairs(data.disable or {}) do
|
||||
for _, lang in ipairs(config.modules[name].disable) do
|
||||
disable_mod_conf_autocmd(new_path, lang)
|
||||
end
|
||||
end, config.modules)
|
||||
end, config.modules[name])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue