diff --git a/README b/README index 6c6989e..586ef6f 100644 --- a/README +++ b/README @@ -34,6 +34,7 @@ EXAMPLES z -r foo cd to highest ranked dir matching foo z -t foo cd to most recently accessed dir matching foo z -l foo list all dirs matching foo (by frecency) + z --index index all subdirectories of the current dir NOTES diff --git a/z.1 b/z.1 index 5742379..05d8a38 100644 --- a/z.1 +++ b/z.1 @@ -23,6 +23,9 @@ directory that matches ALL of the regexes given on the command line. \fB\-r\fR match by rank only .br \fB\-t\fR match by recent access only +.br +\fB\--index\fR Index all subdirectories of the current dir +.br .SH EXAMPLES \fBz foo\fR cd to most frecent dir matching foo diff --git a/z.sh b/z.sh index 919d49f..884fdf3 100755 --- a/z.sh +++ b/z.sh @@ -22,6 +22,7 @@ # * z -r foo # cd to highest ranked dir matching foo # * z -t foo # cd to most recently accessed dir matching foo # * z -l foo # list all dirs matching foo (by frecency) +# * z --index # index all subdirectories of the current dir _z() { @@ -29,6 +30,11 @@ _z() { # bail out if we don't own ~/.z (we're another user but our ENV is still set) [ -f "$datafile" -a ! -O "$datafile" ] && return + # Index subdirectories + +if [ "$1" = "--index" ]; then + find '`pwd`' -type d -exec z --add \'\{\}\' \; +fi # add entries if [ "$1" = "--add" ]; then