aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSidhanth Rathod <siduck@tutanota.com>2022-08-14 10:50:26 +0530
committerGitHub <noreply@github.com>2022-08-14 10:50:26 +0530
commit8790658e139c1852b0f096e0aecd4f1eac5bd116 (patch)
tree04105081ed1970c2f73e354291a55d3c7d264f12
parentfix #16: expose shell configuration option (diff)
parentAdd function to toggle all terminal windows (diff)
Merge pull request #18 from shaun-mathew/patch-1
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))