Comments (4)
@LoydAndrew that's a cool idea tbh I hadn't really considered it ever. There isn't really a way to do that currently but I like the idea. I think a reverse command would be good as well i.e. toggle all with none open opens all the previously opened and then using that again toggles them all.
It wouldn't be too hard to implement basically could add a check for the all
argument to the toggle term commannd and then loop through all terminals and call toggle. I guess the potentially weird edge case would be if one terminal was open and you hit TermToggle all
should that open the rest or close the open one.
Maybe in that case it should work more explicitly ToggleTermCloseAll
or ToggleTermOpenAll
and then it can be explicitly mapped to opening any that aren't open or just closing them all.
Anyway I'd be happy to help direct a PR for this, most of the logic to do this is already there just needs commands defined and cobble thing together
" in toggleterm.vim
command! ToggleTermCloseAll lua require('toggleterm').toggle_all('close')
command! ToggleTermOpenAll lua require('toggleterm').toggle_all('open')
Then in toggleterm.lua
function M.toggle_all(command)
for _, term in get_all() then
if direction == "close" then
term:close()
else
if not term:is_open() then
term:toggle()
end
end
end
end
from toggleterm.nvim.
@LoydAndrew it was pretty straightforward to do i.e. more or less exactly what I had above so I just did it in my lunch break. Can you test it out and see if it works
from toggleterm.nvim.
@akinsho
Thanks, great and quick work. I guess the only problem is to have 2 explicit commands rather then one toggle, but I can live with that. Again, very appreciate it.
from toggleterm.nvim.
@LoydAndrew if you had only one command and had 1 window open it's not clear how it should work. Should it close that window or open other windows you previously toggled 🤷🏾♂️ I'm definitely open to a PR to fix it though but I probably won't spend more time on it myself, this isn't really a workflow I use
from toggleterm.nvim.
Related Issues (20)
- Question: keep terminal opened for session HOT 2
- [QUESTION] Full screen when using float direction HOT 3
- [Feature request/Question] `TermExec` change terminal options for floating windows HOT 1
- Is it possible to include double quotes in the `cmd` argument?
- [BUG] `hide_numbers = false` in configuration, doesn't works HOT 4
- [BUG] Leader "<space>" lags in toggleterm with no imap/tmap and insert_mappings=false HOT 2
- [BUG] Cursor hides when scrolling down HOT 1
- [BUG] Clean the terminal does not work on windows when updating the directory
- send buffer to terminal HOT 1
- [Suggestion] Floating terminal position relative to editor HOT 4
- [BUG] `:tabnew %` on a toggleterm buffer causes it to lose cursor position HOT 1
- Q: How do you close a terminal? HOT 1
- [BUG] images support bug? HOT 2
- Can't use terminal keymaps HOT 1
- [BUG] Calling toggle in quick succession does not respect persist_mode/start_in_insert HOT 1
- [Feature Request] Next/Previous Terminal HOT 2
- [BUG] windows Custom Terminals fail
- [BUG] weird black space at the left of the terminal HOT 6
- Is it possible to allow users to open the toggleterm in the current window, just like :term? HOT 1
- Help Request: Issues trying to set toggle-term on Windows HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from toggleterm.nvim.