feat(terminal): add toggle_all()
function
#421
+41
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
I am enjoying the
terminal
plugin quite a lot - but when I worked with more than one terminal I found it annoying to have to close all terminal windows one by one and then reopen them one by one.This PR adds a
toggle_all()
function toterminal.lua
which opens all closed terminals (if any) or closes all opened terminals (if any). If no terminals have been opened, it will default to opening a new one (similar to theget()
function).Maybe this could be implemented in userland but I could not find a nice way to do that. It also helps a lot to have access to the
terminals
variable!Let me know what you think!
Screencast
In the following screencast I first toggle terminal 1 and then I toggle terminal 2.
I then use the newly added
toggle_all
function to close and open both terminals with theCtrl-\
keybind.Screen.Recording.2025-01-05.at.13.00.06.mov