Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(terminal): add toggle_all() function #421

Closed
wants to merge 1 commit into from
Closed

Conversation

ollema
Copy link

@ollema ollema commented Jan 5, 2025

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 to terminal.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 the get() 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 the Ctrl-\ keybind.

Screen.Recording.2025-01-05.at.13.00.06.mov

@ollema ollema changed the title add toggle_all function to terminal.lua feat: add toggle_all() function to terminal.lua Jan 5, 2025
@ollema ollema changed the title feat: add toggle_all() function to terminal.lua feat(terminal): add toggle_all() function Jan 5, 2025
@ollema ollema changed the title feat(terminal): add toggle_all() function feat(terminal): add toggle_all() function Jan 5, 2025
@ollema
Copy link
Author

ollema commented Jan 6, 2025

uh I have no idea why that bot decided to nuke my change, I probably misunderstood how to configure that in my fork. removed the app now and force pushed the actual change

@ollema ollema force-pushed the main branch 2 times, most recently from ddaefd2 to f0c2d38 Compare January 15, 2025 09:55
@ollema
Copy link
Author

ollema commented Feb 7, 2025

could potentially close #759

@folke folke closed this in 73c4b62 Feb 7, 2025
folke pushed a commit that referenced this pull request Feb 8, 2025
🤖 I have created a release *beep* *boop*
---


##
[2.20.0](v2.19.0...v2.20.0)
(2025-02-08)


### Features

* **picker.undo:** `ctrl+y` to yank added lines, `ctrl+shift+y` to yank
deleted lines
([3baf95d](3baf95d))
* **picker:** added treesitter symbols picker
([a6beb0f](a6beb0f))
* **terminal:** added `Snacks.terminal.list()`. Closes
[#421](#421). Closes
[#759](#759)
([73c4b62](73c4b62))


### Bug Fixes

* **explorer:** change grep in item dir keymap to leader-/. Closes
[#1000](#1000)
([9dfa276](9dfa276))
* **layout:** take winbar into account for split layouts. Closes
[#996](#996)
([e4e5040](e4e5040))
* **picker.git:** account for deleted files in git diff. Closes
[#1001](#1001)
([e9e2e69](e9e2e69))
* **picker.git:** handle git status renames. Closes
[#1003](#1003)
([93ad23a](93ad23a))
* **picker.lines:** use original buf instead of current (which can be
the picker on refresh)
([7ccf9c9](7ccf9c9))
* **picker.proc:** don't close stdout on proc exit, since it might still
contain buffered output. Closes
[#966](#966)
([3b7021e](3b7021e))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant