2023-10-11
Often when I’m editing my fish config, I want to test out my new config.
I can always run fish
to run a new fish shell, which mostly works,
but when I want to exit (possibly quite some time later), I go back to the
original shell (without the latest config).
>*)))>< <*)))>< "how is your posture?"
$ fish
>*)))>< <*)))>< "how is your posture?"
$ # (here I hit control-d to exit)
$ # <- but I'm back to the prompt of the original shell
(yes, my prompt asks me to think about my posture. Yes, I have completely tuned it out.)
It’s a minor annoyance but luckily there’s a way to fix this behaviour:
by running exec fish
instead of fish
. This will use exec
to replace the original fish
process with the new one.
>*)))>< <*)))>< "how is your posture?"
$ exec fish
>*)))>< <*)))>< "how is your posture?"
$
# at this point, sending control-d will close the shell.
For ease of running this, I have an abbr to expand ef
to exec fish
.
Now when I want to test out my new fish config, I just hit ef<enter>
and I’m in the new shell!