Support custom environment. #21835

Closed
opened 2026-01-31 07:56:07 +00:00 by claunia · 4 comments
Owner

Originally created by @zhizhi-dev on GitHub (Jun 6, 2024).

Description of the new feature/enhancement

Like vscode , user can custom enviroment var using json .

{
  "env" : {
    "PYTHONUTF8=1",
  }
}

Proposed technical implementation details (optional)

Originally created by @zhizhi-dev on GitHub (Jun 6, 2024). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> # Description of the new feature/enhancement Like vscode , user can custom enviroment var using json . ```json { "env" : { "PYTHONUTF8=1", } } ``` <!-- A clear and concise description of what the problem is that the new feature would solve. Describe why and how a user would use this new functionality (if applicable). --> # Proposed technical implementation details (optional) <!-- A clear and concise description of what you want to happen. -->
claunia added the Issue-FeatureResolution-Duplicate labels 2026-01-31 07:56:07 +00:00
Author
Owner

@zadjii-msft commented on GitHub (Jun 6, 2024):

Thanks for the request!

And you can enable it like so:

The profile's environment completely replaces the one specified in defaults.

So if you've got:

"defaults": {
  "environment": {
    "Foo": "Bar"
  }
},
"list": [
  {
    "name": "PowerShell",
    "environment": {
      "Baz": "Qux"
    }
  }
]

Your PowerShell profile will get Baz=Qux and your cmd profile will get Foo=Bar.

But looks like it never made it to the docs repo.

@zadjii-msft commented on GitHub (Jun 6, 2024): Thanks for the request! * This was originally tracked in /dup #2785 * it was added in #15082 * and that first shipped in Terminal 1.18 And you can enable it like so: > The profile's environment completely replaces the one specified in defaults. > > So if you've got: > > ```json > "defaults": { > "environment": { > "Foo": "Bar" > } > }, > "list": [ > { > "name": "PowerShell", > "environment": { > "Baz": "Qux" > } > } > ] > ``` > > Your PowerShell profile will get `Baz=Qux` and your cmd profile will get `Foo=Bar`. But looks like it never made it to the docs repo.
Author
Owner

@microsoft-github-policy-service[bot] commented on GitHub (Jun 6, 2024):

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@microsoft-github-policy-service[bot] commented on GitHub (Jun 6, 2024): Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report! <!-- Policy app identification https://img.shields.io/static/v1?label=PullRequestIssueManagement. -->
Author
Owner

@zhizhi-dev commented on GitHub (Jun 7, 2024):

thanks !!

@zhizhi-dev commented on GitHub (Jun 7, 2024): thanks !!
Author
Owner

@ThioJoe commented on GitHub (Jun 7, 2024):

This is perfectly timed, literally today I was wondering if there is a way to customize how the prompt text looks to add a space before the cursor, and turns out there is!

"environment": {
                "PROMPT": "$P$G$S"
            }
@ThioJoe commented on GitHub (Jun 7, 2024): This is perfectly timed, literally today I was wondering if there is a way to customize how the prompt text looks to add a space before the cursor, and turns out there is! ``` "environment": { "PROMPT": "$P$G$S" } ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#21835