Sublime Forum

Open terminus in a split view

#1

hi,

I am new to Origami. The developer’s site for Terminus describes how to open terminus in split view.

I have this working for terminus_open, which is using Terminus View.

In my build system I am using terminus_exec which works with Terminus Panel.

I want to have the build output on the left instead of below. How can I have the console output of terminus_exec in a View instead of a Panel?

0 Likes

#2

terminus_exec is a drop-in replacement for exec (the standard command for executing a build) but behind the scenes it’s just executing terminus_open in order to execute the build, so it takes the same arguments as terminus_open would take, except that the defaults for arguments when you don’t provide them are different for teminus_exec than for terminus_open.

With that said, the argument that makes terminus_open use a panel over a view is panel_name; specifying that makes terminus_open create a panel, and not specifying one opens a view instead. In order to be a drop-in replacement for exec (which executes in a panel), terminus_exec enforces the panel_name argument and in fact will throw an exception if you try to use it or specify it directly (in this case to remove it so that it will open in a view).

So in that sense, what you’re trying to do is not possible using terminus_exec directly because you can’t provide it the argument that it needs in order to open in a view so that it can be side by side. To do this you need to use terminus_open instead and pass it some additional arguments. For example:

{
    "target": "terminus_open",

    "shell_cmd": "sleep 20 && ls",

    "title": "Terminus Build Results",
    "auto_close": false,
    "timeit": true,

    "post_window_hooks": [ ["carry_file_to_pane", {"direction": "left"}] ],
}

That will execute the the command in a view with a given title, get it to time its output like a build would, and block it from closing when the task finishes (so you can see the results). It also uses the post_window_hooks argument to carry the pane left.

In this scenario you need to close the tab manually in order to cancel the build early; the terminus_cancel_build command won’t work because it’s looking for a panel with a specific name to close but the output is no longer in a panel.

With auto_close being set to false, finished builds will stack up in the left pane so you’ll need to clear them manually. You can set the value to true (or remove it entirely since true is the default) if you don’t need to see the output of the build after it’s done executing.

1 Like

#3

Hi @OdatNurd, have 2 questions, pls.
1st How can i stop creating the build panel for each run, wana same behavior like with “target”: “terminus_exec”, panel to reset instead of initiating new instance !.
2nd is it possible to show previous run result ?

0 Likes

#4

I’m not sure I understand your question; are you asking how to make Terminus always create a brand new panel instead of destroying and recreating the same one?

0 Likes

#5

I believe if brand new panel as of current am getting multiple panels instances created with every run which is very annoying. Instead wanna to have a single panel only regardless the number of run.

0 Likes

#6

There’s not a way to have Terminus keep re-using the same panel (or tab) in a way that lets you see previous runs as a part of a build system because when the task that builds is completed, the connection that Terminus makes to it to be able to gather it’s output is broken.

0 Likes

#7

I am also new to terminus and wanted something similar. I just found out that one can use terminus together with sendcode to this effect: open a usual terminus view in a separate pane, then use sendcode to send the build command to the terminus view. The result is exactly the same as if you used a terminal and typed in the build command.

Here is my sendcode setting:
{
“python” : {
“prog”: “terminus”,
“bracketed_paste_mode”: false,
}
Then for the build command:
{
“keys”: [“ctrl+shift+h”], “command”: “send_code”,
“args”: {“cmd”: “python “$file_name””},
“context”: [
{ “key”: “selector”, “operator”: “equal”, “operand”: “source.python” }
]
}

0 Likes

#8

For a solution like that, see also this, which does something similar without using SendCode (on purpose):

2 Likes