diff --git a/z.1 b/z.1 index bba9d78..bfeae42 100644 --- a/z.1 +++ b/z.1 @@ -87,6 +87,9 @@ Set \fB$_Z_EXCLUDE_DIRS\fR to an array of directories to exclude. Set \fB$_Z_OWNER\fR to allow usage when in 'sudo -s' mode. .RE .RS +set \fB$_Z_NO_PRUNE\fR if you want to prevent entries that do not exist from removal (useful if you have network drives - entries will still age out). +.RE +.RS (These settings should go in .bashrc/.zshrc before the line added above.) .RE .RS diff --git a/z.sh b/z.sh index a8c6a89..4a8a645 100644 --- a/z.sh +++ b/z.sh @@ -14,6 +14,8 @@ # set $_Z_NO_PROMPT_COMMAND if you're handling PROMPT_COMMAND yourself. # set $_Z_EXCLUDE_DIRS to an array of directories to exclude. # set $_Z_OWNER to your username if you want use z while sudo with $HOME kept +# set $_Z_NO_PRUNE if you want to prevent entries that do not exist from removal (useful if you have network drives - entries will still age out). + # # USE: # * z foo # cd to most frecent dir matching foo @@ -51,7 +53,7 @@ _z() { local tempfile="$datafile.$RANDOM" while read line; do # only count directories - [ -d "${line%%\|*}" ] && echo $line + [ -d "${line%%\|*}" -o "$_Z_NO_PRUNE" ] && echo $line done < "$datafile" | awk -v path="$*" -v now="$(date +%s)" -F"|" ' BEGIN { rank[path] = 1