1

I'm using Sublime Text 4's Terminus package and trying to open more than one terminal session within Sublime's panel view.

enter image description here

In VSCode it looks like this:

enter image description here

The closest I can get is to open each session in a separate tab on grid layout, which works fine, but I get the minimap which is not desired, and also I loose the ability to toggle open & close as opposed to the panel:

enter image description here

After doing a bit of research & watching this video I see in the comments the following question & answer:

Q: is there any way to open several instances of Terminus in the panel? I could open several instances of it in Tab View, but not in the bottom panel.

A: There is an argument you can use in the terminus commands named "panel"; that gives the created panel a name. If you don't provide it there's a default. Using a different panel name lets you create or toggle extra panels.

So I've been testing Terminus settings with that in mind but no luck so far.

Terminus key bindings:

{ 
    "keys": ["ctrl+alt+p"], 
    "command": "toggle_terminus_panel", 
    "args": {
        "panel": "git",
        "cwd": "${file_path:${folder}}"
    }
}

With the above, terminal does open from panel but always with one session, if I add another key binding with a different panel name it still opens & closes the same session as the other key binding. Tried also "command": "terminus_open" instead of "command": "toggle_terminus_panel", but doesn't work with panel as argument. Adding another panel name like the following does nothing either:

"args": {
    "panel": "git",
    "panel": "server",
}

Is this actually possible or what am I missing?

Syden
  • 8,425
  • 5
  • 26
  • 45
  • That is because ST doesn't yet have the concept of "multi tabbed" panels. The panel just represents a single view (& only one panel can be shown at any given time for a given window). The only choice is therefore to open several terminus views in their own tabs (as you have already done). Here is the feature request if you want to give it a thumbs up https://github.com/sublimehq/sublime_text/issues/2599 – Ashwin Shenoy Jul 09 '21 at 06:14
  • Thanks Ashwin. I guess OdatNurd's video reply doesn't really work then, kinda makes sense why he didn't showcase it afterall. Going through the github thread, I see the request is mainly multiple tabs in panel, this is not exactly what I want although it may give the possibility to achieve it? I'd like more terminal sessions within the same "tab" separated by a division line or something (as you can see in the VSCode picture). Either way, unbelievable in 2021 an improvement like this doesn't have the priority it deserves from the Sublime team. – Syden Jul 09 '21 at 12:29
  • @Syden see my answer below; I used the wrong argument name in my comment on YouTube (I just edited it to fix it); it's possible to have multiple panels, you just don't get a tabbed interface or visible name and you can't view them both at the same time. As such, what's possible and what you want may still not match up. – OdatNurd Jul 09 '21 at 16:54

1 Answers1

1

As noted in the comments on your question, if your goal is to have multiple panels open simultaneously each with a different visible name (i.e. a tabbed panel interface) that's not possible because currently Sublime supports only a single visible panel at a time.

However, if the goal is to have multiple panels that you call up via key bindings, that is indeed possible. What you tried doesn't work because the argument name is actually panel_name and not panel (sorry for the confusion; I've edited the comment on my video as well to reflect that).

So you can do something like this:

    { "keys": ["alt+`"], "command": "toggle_terminus_panel", "args": {
        "panel_name": "first-panel"
    }, },

    { "keys": ["shift+alt+`"], "command": "toggle_terminus_panel", "args": {
        "panel_name": "other-panel"
    }, },

The important consideration is that all key bindings need to include panel_name in them; if you don't provide the argument Terminus defaults to finding and opening the most recently active panel, whatever it happened to be.

Thus you could use a third binding if you always wanted to go to the most recent, if that is also interesting.

Note also that in your question you mentioned putting this in Terminus settings; the appropriate place is in your Key bindings (Preferences > Key Bindings).

OdatNurd
  • 21,371
  • 3
  • 50
  • 68
  • Thanks Odat, not exactly what I'm looking for but I appreciate the reply. I've tried the suggestion above but either one gets overridden when the next key binding is used, always having 1 same panel. In fact, I don't see the use for the name as it doesn't display anywhere in the panel (nor tab). I think the limiting factor is both bindings using `toggle_terminus_panel` (you are right I wrote mistakenly settings but was in key bindings). If I set a binding to `terminus_open` and the other one to `toggle_terminus_open` then both work individually, one in tab and the other in panel. – Syden Jul 09 '21 at 17:30
  • I ended up with the following setup https://imgur.com/sabJdyL using Origami, not exactly the same but I preserve the ability to toggle open & close one of them. Thanks a lot for the help! Regards. – Syden Jul 09 '21 at 17:32
  • The bindings should toggle between the two panels; note however that while a terminus pane/view has the input focus, keys go there; so you need to toggle away one panel before you can open the other (otherwise, the second key does effectively nothing). Panel names appear in the panel chooser (right click the icon on the far left of the status bar). Glad you got up and running though – OdatNurd Jul 09 '21 at 18:11
  • Ahh you are right, although trying out several different key bindings now it seems to switch panels even without removing the focus from it lol. While still not as I'd picture it, this could work until (hopefully someday) they add this functionality.. will give it a try a few days. Thanks again, upvote. – Syden Jul 09 '21 at 20:25