randy3k / Terminus

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

How to open terminus running additional commands? #342

Open brupelo opened 2 years ago

brupelo commented 2 years ago

Hi,

For the last years I've been using sublime_text with https://conemu.github.io/ in a way where i'm able to specify wich type of task I want spawn conemu with. For instance, I'm able to spawn conemu with a particular virtualenv activated, or conemu with visual studio environment enabled, or spawn vagrant tasks, npm commands, etc etc... All available tasks from conemu I'll be able to spawn them from SublimeText.

Now, it'd be interesting to switch from conemu to terminus as it's a really cool project. But first I'd like to know if it was possible to achieve the same somehow, here's a little example of how you'd spawn conemu with visualstudio+virtualenv enabled:

D:\software\conemu\conemu.exe -single -cmd -new_console:s50V -new_console:t:VS15_x86 cmd /k "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Auxiliary/Build/vcvarsall.bat" x86 & d:\virtual_envs\py_310_32\Scripts\activate

Would it be possible to specify to terminus_open a particular command I want to be executed once the terminal is created?

Thanks in advance.

brupelo commented 2 years ago

In fact, if you were able to do that, it'd be cool to add "Tasks support" to terminus, similarly to conemu, here's what the concept of task looks like

image

Basically with conemu you can have your favourite tasks saved in your conemu settings, which it's the file i'm reading from to offer from sublime_text some popup where the user can pick up from.

brupelo commented 2 years ago

Ok, I've figured out you can use cmd or shell_cmd with terminus_open, ie:

    {
        "name": "Command Prompt",
        "shell_cmd": "cmd.exe /k \"echo 1 & echo 2\"",
        "env": {},
        "enable": true,
        "platforms": ["windows"]
    }

But now I'm struggling to understand how I can run a complex command (path that contains spaces) that'd work in my command prompt such as

cmd /k ""C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Auxiliary/Build/vcvarsall.bat" x86 & d:\virtual_envs\py389_32\Scripts\activate"

image

with terminus 😃