Julia: Provide startup option to include current active environment in julia prompt

Created on 13 May 2020  Â·  1Comment  Â·  Source: JuliaLang/julia

If you're changing environments a lot it's easy to make mistakes where you think you're in one environment but you're actually in another. It would be nice if there were a startup option that would change the Julia prompt to include the current active environment, so it would look like this:

(@v1.4) julia>

or this:

(Example.jl) julia>

Most helpful comment

julia> using Pkg

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

(@v1.4) julia> 1+1
2

(@v1.4) pkg> activate Foo
 Activating new environment at `~/Documents/JuliaPkgs/TOMLX.jl/Foo/Project.toml`

(Foo) julia> 1+1
2

Beautiful API ;)

>All comments

julia> using Pkg

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

(@v1.4) julia> 1+1
2

(@v1.4) pkg> activate Foo
 Activating new environment at `~/Documents/JuliaPkgs/TOMLX.jl/Foo/Project.toml`

(Foo) julia> 1+1
2

Beautiful API ;)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sbromberger picture sbromberger  Â·  3Comments

StefanKarpinski picture StefanKarpinski  Â·  3Comments

manor picture manor  Â·  3Comments

wilburtownsend picture wilburtownsend  Â·  3Comments

Keno picture Keno  Â·  3Comments