# Provide startup option to include current active environment in julia prompt

**URL:** <https://discourse.julialang.org/t/provide-startup-option-to-include-current-active-environment-in-julia-prompt/43306>\
**Category:** Internals & Design\
**Created:** [July 18, 2020, 7:34pm UTC](https://discourse.julialang.org/t/provide-startup-option-to-include-current-active-environment-in-julia-prompt/43306 "2020-07-18T19:34:32Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![CameronBieganek](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cameronbieganek/32/6915_2.png) [@CameronBieganek](https://discourse.julialang.org/u/CameronBieganek)\
**Post date:** [July 18, 2020, 7:34pm UTC](https://discourse.julialang.org/t/provide-startup-option-to-include-current-active-environment-in-julia-prompt/43306/1 "2020-07-18T19:34:32Z")

</div>

I just experienced the second occasion where I was trying to create a MWE for a bug report, but while creating the MWE I forgot that I was back in my `@v1.4` environment rather than the environment in which I first encountered the error. It would be handy if there were a startup option that would print the currently active environment as part of the `julia>` prompt so that you always know what environment you’re in.

I created a github issue for this the first time that I made that mistake. Give it some thumbs up if you support the change:

[https://github.com/JuliaLang/julia/issues/35876](https://github.com/JuliaLang/julia/issues/35876)

---

<div class="post-metadata">

**Author:** ![dpsanders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dpsanders/32/3573_2.png) [@dpsanders](https://discourse.julialang.org/u/dpsanders)\
**Post date:** [July 18, 2020, 7:49pm UTC](https://discourse.julialang.org/t/provide-startup-option-to-include-current-active-environment-in-julia-prompt/43306/2 "2020-07-18T19:49:18Z")

</div>

You can check that by just typing `]` to go to `Pkg` mode I think?

---

<div class="post-metadata">

**Author:** ![CameronBieganek](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cameronbieganek/32/6915_2.png) [@CameronBieganek](https://discourse.julialang.org/u/CameronBieganek)\
**Post date:** [July 18, 2020, 7:54pm UTC](https://discourse.julialang.org/t/provide-startup-option-to-include-current-active-environment-in-julia-prompt/43306/3 "2020-07-18T19:54:34Z")

</div>

Yeah, I know that. And yet I often forget to explicitly type `]` into the REPL to double check what environment I’m in. Without the explicit visual indication in the normal REPL prompt, it’s easy to subconsciously assume you’re in one environment when you’re actually in another. Especially if you’re changing environments or Julia sessions, it’s easy to lose track of what environment you’re in, and a subconscious assumption might take over.

---

<div class="post-metadata">

**Author:** ![CameronBieganek](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cameronbieganek/32/6915_2.png) [@CameronBieganek](https://discourse.julialang.org/u/CameronBieganek)\
**Post date:** [July 18, 2020, 8:01pm UTC](https://discourse.julialang.org/t/provide-startup-option-to-include-current-active-environment-in-julia-prompt/43306/4 "2020-07-18T20:01:38Z")

</div>

The precedent is already there with Python environments:

### Conda

```julia-auto
bieganek@D20191947:~$ conda activate
(anaconda3) bieganek@D20191947:~$

```

### venv

```julia-auto
$ python3 -m venv myenv
$ source myenv/bin/activate
(myenv) $

```

---

<div class="post-metadata">

**Author:** ![dalejordan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dalejordan/32/2196_2.png) [@dalejordan](https://discourse.julialang.org/u/dalejordan)\
**Post date:** [July 18, 2020, 8:24pm UTC](https://discourse.julialang.org/t/provide-startup-option-to-include-current-active-environment-in-julia-prompt/43306/5 "2020-07-18T20:24:42Z")

</div>

Asked and answered: [https://github.com/JuliaLang/julia/issues/35876](https://github.com/JuliaLang/julia/issues/35876)

---

<div class="post-metadata">

**Author:** ![CameronBieganek](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cameronbieganek/32/6915_2.png) [@CameronBieganek](https://discourse.julialang.org/u/CameronBieganek)\
**Post date:** [July 18, 2020, 8:34pm UTC](https://discourse.julialang.org/t/provide-startup-option-to-include-current-active-environment-in-julia-prompt/43306/6 "2020-07-18T20:34:42Z")

</div>

@dalejordan Yes, I am the one who created that github issue. In case you didn’t realize, the answer given there was tongue-in-cheek. That’s not really meant to be a public API.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [July 19, 2020, 7:04am UTC](https://discourse.julialang.org/t/provide-startup-option-to-include-current-active-environment-in-julia-prompt/43306/7 "2020-07-19T07:04:37Z")

</div>

I think the answer there was in earnest. You can just put that snippet in your `startup.jl` and have the desired behavior.

Not everyone has the same preferences for their prompt, so it is best to just keep it simple by default.

---

<div class="post-metadata">

**Author:** ![CameronBieganek](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cameronbieganek/32/6915_2.png) [@CameronBieganek](https://discourse.julialang.org/u/CameronBieganek)\
**Post date:** [July 19, 2020, 2:04pm UTC](https://discourse.julialang.org/t/provide-startup-option-to-include-current-active-environment-in-julia-prompt/43306/8 "2020-07-19T14:04:33Z")

</div>

Putting

```julia
Base.active_repl.interface.modes[1].prompt =
    () -> string(Pkg.REPLMode.promptf()[1:end-5], "julia> ")

```

in my startup file seems prone to breakage, since it seems to rely on internal implementation details that could change in a new release.

> [@Tamas\_Papp](#):
>
> Not everyone has the same preferences for their prompt, so it is best to just keep it simple by default.

I’m not arguing that the default should be changed. I’m only arguing that there should be a public, easily accessible flag to turn on the display of the current environment in the `julia>` prompt.
