Switching to an editor + repl for unix shells involves a good re-examination of workflows.
With an editor + repl, the editor quickly ends up holding a lot of mini-recipes which involve some state. Ideally, that state is made explicit.
One of the offenders we use a lot is git, as the normal invocation requires the $PWD to be in a git repo, which can be worked around with:
gt() { echo "git --work-tree=${1} --git-dir=${1}/.git"; } git=$(gt ~/etc/) $git status