mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-11 07:50:07 -04:00
Implement TSToggleAll.
This commit is contained in:
parent
8e2807d09e
commit
fdfbb5c1bf
2 changed files with 29 additions and 0 deletions
|
|
@ -254,6 +254,15 @@ Disable {module} for the session
|
||||||
if {language} is specified, disable module for the session only for this
|
if {language} is specified, disable module for the session only for this
|
||||||
particular language.
|
particular language.
|
||||||
A list of modules can be found at |:TSModuleInfo|
|
A list of modules can be found at |:TSModuleInfo|
|
||||||
|
A list of languages can be found at |:TSInstallInfo|
|
||||||
|
|
||||||
|
*:TSToggleAll*
|
||||||
|
:TSToggleAll {module} [{language}]~
|
||||||
|
|
||||||
|
Toggle (enable if disabled, disable if enabled) {module} for the session.
|
||||||
|
If {language} is specified, toggle module for the session only for this
|
||||||
|
particular language.
|
||||||
|
A list of modules can be found at |:TSModuleInfo|
|
||||||
A list of languages can be found at |:TSInstallInfo|
|
A list of languages can be found at |:TSInstallInfo|
|
||||||
|
|
||||||
*:TSModuleInfo*
|
*:TSModuleInfo*
|
||||||
|
|
|
||||||
|
|
@ -151,6 +151,19 @@ local function toggle_module(mod, bufnr, lang)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Toggles the module globally and for all current buffers.
|
||||||
|
-- @param mod path to module
|
||||||
|
local function toggle_all(mod)
|
||||||
|
local config_mod = M.get_module(mod)
|
||||||
|
if not config_mod then return end
|
||||||
|
|
||||||
|
if config_mod.enable then
|
||||||
|
disable_all(mod)
|
||||||
|
else
|
||||||
|
enable_all(mod)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Recurses through all modules including submodules
|
-- Recurses through all modules including submodules
|
||||||
-- @param accumulator function called for each module
|
-- @param accumulator function called for each module
|
||||||
-- @param root root configuration table to start at
|
-- @param root root configuration table to start at
|
||||||
|
|
@ -217,6 +230,13 @@ M.commands = {
|
||||||
"-complete=custom,nvim_treesitter#available_modules",
|
"-complete=custom,nvim_treesitter#available_modules",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
TSToggleAll = {
|
||||||
|
run = toggle_all,
|
||||||
|
args = {
|
||||||
|
"-nargs=+",
|
||||||
|
"-complete=custom,nvim_treesitter#available_modules",
|
||||||
|
},
|
||||||
|
},
|
||||||
TSConfigInfo = {
|
TSConfigInfo = {
|
||||||
run = config_info,
|
run = config_info,
|
||||||
args = {
|
args = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue