diff --git a/plugins/z/z.sh b/plugins/z/z.sh index 4fc75dc6a..5fe6d5266 100644 --- a/plugins/z/z.sh +++ b/plugins/z/z.sh @@ -222,10 +222,16 @@ if type compctl >/dev/null 2>&1; then if [ "$_Z_NO_RESOLVE_SYMLINKS" ]; then _z_precmd() { (_z --add "${PWD:a}" &) + # Reference $RANDOM to refresh its value inside the subshell + # Otherwise, multiple runs get the same value + : $RANDOM } else _z_precmd() { (_z --add "${PWD:A}" &) + # Reference $RANDOM to refresh its value inside the subshell + # Otherwise, multiple runs get the same value + : $RANDOM } fi [[ -n "${precmd_functions[(r)_z_precmd]}" ]] || {