randy3k / Terminus

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

Terminus and Python / conda virtual environments #189

Closed ghost closed 4 years ago

ghost commented 4 years ago

Is it possible to have Terminus automatically activate python and / or conda virtual environments automatically? Ideally on Windows as well as Linux.

randy3k commented 4 years ago

In your .bashrc, just put

if [ "$TERM_PROGRAM" == "Terminus-Sublime" ]; then
    conda activate your_environment
fi
KristoforMaynard commented 4 years ago

@pythonsavvy, I put together a plugin that nearly does what you're looking for: TerminusAddons. It comes with a build system to run scripts (or make) in Terminus, and if a setting called "conda_env" is set in your preferences, it automatically activates a conda environment. It also launches python scripts with pipenv if it sees a Pipfile in a parent directory. The advantage to this approach over using bashrc is it can be set per-project.

ghost commented 4 years ago

Thank you for this. Using it now!

mrrezaie commented 11 months ago

In your .bashrc, just put

if [ "$TERM_PROGRAM" == "Terminus-Sublime" ]; then conda activate your_environment fi

@randy3k Hi, how can I do this in Windows? Is cmd or shell_cmd able to first activate a conda env and then run ipython?

Thank you