So I am working concurrently on two separate projects, let us call them A
and B
. When I am in the working directory of project A
, anything in repl_history.jl
that is connected to project B
is basically clutter, and vice-versa. So starting a new work session in one project requires going faaaar back in history to find what I was doing.
I was going to ask the following question here, but I found an answer in the meantime; I’m leaving both of them here in case it is useful to someone.
Is there a way to have REPL history depend on current directory?
The answer is: since Julia looks at the JULIA_HISTORY
environment variable, we could set this one dependent on the presence of a given file in the current directory; e.g. (in the shell; something similar might be cooked in a Julia init file as well):
julia() {
hist_jl=./.repl_history.jl
[ -f $hist_jl ] && extra="JULIA_HISTORY=$hist_jl"
env $extra =julia "$@"
}