rupa / z

z - jump around
Do What The F*ck You Want To Public License
16.39k stars 1.17k forks source link

z does not work with symbolic links #218

Closed furiel closed 6 years ago

furiel commented 7 years ago

z does not work with symbolic links of directories.

Steps to reproduce:

cd /tmp
mkdir verynewdir
ln -s verynewdir linktoverynewdir
cd linktoverynewdir
z -l linktoverynewdir

The result will be empty.
However with the original directory:

cd ..
cd verynewdir
z -l verynewdir

will output

common:    /tmp/verynewdir
12         /tmp/verynewdir

The expected behaviour would be similar output with the symbolic link directory as well. Similarly, z -t linktoverynewdir could drop me to /tmp/linktoverynewdir

Environment: zsh --version
zsh 5.1.1 (x86_64-ubuntu-linux-gnu) z: 1a361f6dc10e54e34e42f1e03850692959c6b413

Could you check this issue? It would be great if I could use z in a scenario above.

ericbn commented 7 years ago

By default, z resolves the symlinks, so when you cd to linktoverynewdir it actually adds verynewdir to the datafile.

To have the behavior you want, you need to disable this with

export _Z_NO_RESOLVE_SYMLINKS=1

before sourcing your z.sh, so

export _Z_NO_RESOLVE_SYMLINKS=1
. /usr/local/etc/profile.d/z.sh
furiel commented 6 years ago

@ericbn thanks for your answer, it works like charm. Sorry for the late response, somehow I missed your answer, probably overlooked a notification. My problem is resolved, so I close the issue now.