randy3k / Terminus

Bring a real terminal to Sublime Text
https://packagecontrol.io/packages/Terminus
MIT License
1.39k stars 81 forks source link

Building with Terminus, opens a new tab #229

Open hwonsok opened 4 years ago

hwonsok commented 4 years ago

I am currently using Terminus with Origami to pop up the console on the right pane.

Every time a I build using Terminus, a new tab is created instead of the current open one being updated.

As I am trying to replicate sublime text's console as much as possible, I would like to know if there is a way to disable a new tab to be opened and updating the current one instead.

randy3k commented 4 years ago

How about using the panel?

hwonsok commented 4 years ago

I am sorry but I am very new to sublime text so I am not really sure what panel you are referring to.

randy3k commented 4 years ago

In that case, you may want to consider looking at this section https://github.com/randy3k/Terminus#terminus-build-system

hwonsok commented 4 years ago

I have created a new .sublime-build file that has the following configuration:

{
    "target": "terminus_open",

    "auto_close": false,

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

    "shell_cmd": "python -u \"$file\"",
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    "selector": "source.python",

    "env": {"PYTHONIOENCODING": "utf-8"},

    "variants":
    [
        {
            "name": "Syntax Check",
            "shell_cmd": "python -m py_compile \"${file}\"",
        }
    ]
}

Still not entirely sure if this is what you are referring to.

randy3k commented 4 years ago

You could use the target

            "target": "terminus_exec",
            "cancel": "terminus_cancel_build",

instead. The cancel command is also recommended

hwonsok commented 4 years ago

By using "target": "terminus_exec", it does indeed make Terminus operate just as the console, but I am no longer able to move it to the right pane as it is no longer a tab.

I am uncertain if this is a situation I have to choose in between:

  1. Terminus behaving as the console but not able to move it to the right pane.
  2. Being able to move Terminus to the right pane, but a new tab being created every time a file is built.

I wonder if there is a third scenario where it is possible to have the Terminus behave as the console but also move it to the right pane. Even if it is as simple as having Terminus open a new tab and close the previous one (if one is currently open).

randy3k commented 4 years ago

Seems fair, I have just pushed a new commit afb5a7c which allows reusing the tagged view. Something along this line.

{
    "target": "terminus_open",

    "tag": "python build",

    "auto_close": false,

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

    "shell_cmd": "python -u \"$file\"",
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    "selector": "source.python",

    "env": {"PYTHONIOENCODING": "utf-8"},

    "variants":
    [
        {
            "name": "Syntax Check",
            "shell_cmd": "python -m py_compile \"${file}\"",
        }
    ]
}
hwonsok commented 4 years ago

I'll wait for the next update. Thank you very much!

g-regor commented 3 years ago

Is this supposed to work now?

With

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

it keeps splitting the right most pane and adding the tab there.

hovsater commented 2 years ago

@randy3k has a regression been introduced since https://github.com/randy3k/Terminus/commit/afb5a7ce57a8a7fde1c5c4e63f5bddba374ae669? I've added a tag to my build system but terminus_open still opens a new tab for each invocation.

hovsater commented 2 years ago

Ping @randy3k.