aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshaun-mathew <shaun-mathew@users.noreply.github.com>2022-08-14 01:00:28 -0400
committerGitHub <noreply@github.com>2022-08-14 01:00:28 -0400
commit85f8e73398db91db85f8a9e1cebb13737348455f (patch)
tree04105081ed1970c2f73e354291a55d3c7d264f12
parentfix #16: expose shell configuration option (diff)
Add function to toggle all terminal windows
-rw-r--r--lua/nvterm/terminal.lua13
1 files changed, 13 insertions, 0 deletions
diff --git a/lua/nvterm/terminal.lua b/lua/nvterm/terminal.lua
index ad06c5b..d797b73 100644
--- a/lua/nvterm/terminal.lua
+++ b/lua/nvterm/terminal.lua
@@ -139,6 +139,19 @@ nvterm.toggle = function(type)
end
end
+nvterm.toggle_all_terms = function()
+ terminals = util.verify_terminals(terminals)
+
+ for _, term in ipairs(terminals.list) do
+ if term.open then
+ nvterm.hide_term(term)
+ else
+ nvterm.show_term(term)
+ end
+ end
+end
+
+
nvterm.close_all_terms = function()
for _, buf in ipairs(nvterm.list_active_terms "buf") do
vim.cmd("bd! " .. tostring(buf))