-
Notifications
You must be signed in to change notification settings - Fork 8.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Preserve virtualenv prompt when duplicating panes #14620
Comments
This is kinda a Hard problem. The Terminal can't really know about the env vars of the child subprocesses like that. (especially consider a scenario like The closest we'll be able to do on that front is probably something like #2785, to have a set of environment variables in the settings for the profile manually. Alternatively, you could just make a specific profile for that specific virtual environment, with the commandline something like
I'd be curious how they accomplish that without hooks of some sort - are they like, reporting every environment variable change up to the Terminal some how? That'd be... impractical, and impossible for CMD. Maybe that's a shell feature, of something like cmder? Maybe that's just a visual artifact, and not actually a full clone? Maybe they're just blindly copying the env vars from the first attached process to duplicated processes? That seems like a heuristic to me though |
Mmm, I understand what you're saying there... In any case, I'd just like to know what's the best practice/feature to use here with wt. Consider this scenario, having many dozens of python repos (if not hundreds) each one with their own virtualenv. Obviously it'd be nice having a plugin in your favourite text editor (vscode, sublime_text, atom, put_your_favourite_here) where you'd be able directly to spawn/activate your venv in wt, right? I mean, with conemu I had coded this sort of plugin in the past and it was pretty handy. I'm thinking... is it possible to have "parametrized profiles"? Ie. can you inject external parameters to the profile? That way you'd be able to reuse the same profile amongst different venvs. Just thinking loud here. Anyway, later on I'll play around with conemu and share my findings here... But what you're saying seems plausible and maybe conemu is using some sort of heuristic at the end of the day that won't work in the general case. Here's a little example of creating/activating/splitting_horizontally/splitting_vertically in conemu though (vc=virtualenv creation, va=virtualenv activation) |
We're keeping the discussion about parameterized profiles in #5571. We'd definitely like to make this easier, so feel free to chip in over there. We'd love to hear what you come up with 😊. |
Consider this docs section https://learn.microsoft.com/en-us/windows/terminal/tutorials/new-tab-same-directory , I've already tried
to change the prompt env var to
$e]9;9;$P$e\$P$G
and works fairly ok. There is a catch though... let's say you've activated a pythonvirtualenv and you duplicate a pane... while the new environment (path + env.vars) will be inherited the prompt won't be the same than
before, is there any workaround for this one?
In conemu you'd have this nice behaviour out of the box.
Example when spawning this command
as you can see the duplicated bottom pane won't have the (venv) in the prompt
The text was updated successfully, but these errors were encountered: