diff --git a/README b/README index 8f6c834..47e54c5 100644 --- a/README +++ b/README @@ -59,6 +59,8 @@ NOTES Optionally: Set $_Z_CMD to change the command name (default z). Set $_Z_DATA to change the datafile (default $HOME/.z). + Set $_Z_MAX_SCORE lower to age entries out faster (default + 9000). Set $_Z_NO_RESOLVE_SYMLINKS to prevent symlink resolution. Set $_Z_NO_PROMPT_COMMAND to handle PROMPT_COMMAND/precmd your- self. diff --git a/z.1 b/z.1 index d4cac1a..182f981 100644 --- a/z.1 +++ b/z.1 @@ -78,6 +78,9 @@ Set \fB$_Z_CMD\fR to change the command name (default \fBz\fR). Set \fB$_Z_DATA\fR to change the datafile (default \fB$HOME/.z\fR). .RE .RS +Set \fB$_Z_MAX_SCORE\fR lower to age entries out faster (default \fB9000\fR). +.RE +.RS Set \fB$_Z_NO_RESOLVE_SYMLINKS\fR to prevent symlink resolution. .RE .RS diff --git a/z.sh b/z.sh index 2b7f87a..22386b4 100644 --- a/z.sh +++ b/z.sh @@ -10,6 +10,7 @@ # * optionally: # set $_Z_CMD in .bashrc/.zshrc to change the command (default z). # set $_Z_DATA in .bashrc/.zshrc to change the datafile (default ~/.z). +# set $_Z_MAX_SCORE lower to age entries out faster (default 9000). # set $_Z_NO_RESOLVE_SYMLINKS to prevent symlink resolution. # set $_Z_NO_PROMPT_COMMAND if you're handling PROMPT_COMMAND yourself. # set $_Z_EXCLUDE_DIRS to an array of directories to exclude. @@ -62,7 +63,8 @@ _z() { # maintain the data file local tempfile="$datafile.$RANDOM" - _z_dirs | awk -v path="$*" -v now="$(date +%s)" -F"|" ' + local score=${_Z_MAX_SCORE:-9000} + _z_dirs | awk -v path="$*" -v now="$(date +%s)" -v score=$score -F"|" ' BEGIN { rank[path] = 1 time[path] = now @@ -79,7 +81,7 @@ _z() { count += $2 } END { - if( count > 9000 ) { + if( count > score ) { # aging for( x in rank ) print x "|" 0.99*rank[x] "|" time[x] } else for( x in rank ) print x "|" rank[x] "|" time[x]