I'm having trouble with a basic behavior of cd
in fish
shell.
cd
to relative directoryI'm willing to change directory using a relative path without the ./
. The directory exists:
❯ ls
addons/ custom-addons/ docker-compose.yml
The directory is auto-completed, yet I can't change to it:
❯ cd addons/
cd: The directory “addons/” does not exist
CDPATH
set -gx CDPATH $CDPATH $HOME/projects
As described in the documentation section Special Variables:
CDPATH
, an array of directories in which to search for the new directory for the cd builtin. By default, the fish configuration definesCDPATH
to be a universal variable with the values.
and~
.
I was overriding the default value while omitting .
and ~
value.
Adding them back solved the issue, in ~/.config/fish/config.fish
:
set -gx CDPATH $CDPATH . ~ $HOME/projects
Then reload fish
with:
exec fish