Using fish, version 3.0.2, on macOS Mojave 10.14.4.
I would like to share my cd / cdh history between fish instances.
Quoting man cdh:
Note that the cd command limits directory history to the 25 most recently visited
directories. The history is stored in the $dirprev and $dirnext variables which
this command manipulates. **If you make those universal variables your cd history is
shared among all fish instances.**
Taking a look at the share/functions/cd.fish file, we can see that the $dirprev variable is set at the global scope, shadowing the universal variable of the same name.
Maybe we can fix this by honoring $dirprev scope if its set universally? I opened #5796 to this effect.
The text was updated successfully, but these errors were encountered:
Is there a reason we can't just unconditionally honor any existing scope of dirprev?
As in the following:
set -q dirprev
and set -a dirprev $previous
or set -g -a dirprev $previous
Edit: never mind, read the context. Don't quite get why it's being set locally there in the earlier lines... it doesn't appear that setting it locally would impact the following lines, either in the unmodified version or in your PR.
Does make me wonder about whether something like set -qgU should be legal, in order to be able to say 'if it's set globally or universally, don't change its scope when appending'.