Think of it as a hook to create named directories that is triggered at variable setting.
So if auto_name_dirs
parameter is set and you set some value % TMP=/tmp
, it will also create a named dir for /tmp
using TMP
. If you later unset the parameter, the directory name remains. If you create a number of variables % USER=/usr
with auto_name_dirs
unset, and after set the option, no directory naming will take place.
~ % zsh -f
dhcp-193-107% setopt autonamedirs
dhcp-193-107% TMP=/tmp
dhcp-193-107% export PS1="dir-prompt %~ : "
dir-prompt ~ : cd /tmp
dir-prompt ~TMP : unset autonamedirs
dir-prompt ~TMP : cd /
dir-prompt / : cd /tmp
dir-prompt ~TMP : # see the dir name still exists
dir-prompt ~TMP : USER=/usr
dir-prompt ~TMP : cd /usr
dir-prompt /usr : # no dir name for /usr
dir-prompt /usr : setopt autonamedirs
dir-prompt /usr : cd /
dir-prompt / : cd /usr
dir-prompt /usr : # still no dir name for /usr