2

In bash, I can put set -P in my .bashrc, and to use absolute paths. That is, if I change to a directory through a symbolic link, and then use cd .., it takes me to that directory's canonical parent, not the directory containing the symbolic link.

How can I configure zsh to always use absolute paths?

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
Dan
  • 9,372
  • 5
  • 25
  • 39

1 Answers1

6

From zshoptions(1)

   CHASE_LINKS (-w)
          Resolve symbolic links to their true values when changing direc-
          tory.  This also has the effect of CHASE_DOTS, i.e. a `..'  path
          segment  will  be  treated  as referring to the physical parent,
          even if the preceding path segment is a symbolic link.

So you would setopt CHASE_LINKS somewhere in your .zshrc. There are also flags to cd that will vary how cd behaves.

          If  the -s option is specified, cd refuses to change the current
          directory if the given pathname contains symlinks.   If  the  -P
          option is given or the CHASE_LINKS option is set, symbolic links
          are resolved to their true values.  If the -L  option  is  given
          symbolic  links are retained in the directory (and not resolved)
          regardless of the state of the CHASE_LINKS option.
thrig
  • 34,333
  • 3
  • 63
  • 84