From 183fa795d7437d43388ddc6d61c193c5de648625 Mon Sep 17 00:00:00 2001 From: William Ting Date: Sun, 27 May 2012 13:14:01 -1000 Subject: [PATCH] Update scripts to use version agnostic pattern matching and corresponding documentation. --- README.md | 4 +++- bin/autojump.zsh | 15 ++++----------- docs/autojump.1 | 5 ++++- docs/body.md | 2 +- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index cf07b23..cd7eace 100644 --- a/README.md +++ b/README.md @@ -189,7 +189,9 @@ ADVANCED USAGE KNOWN ISSUES ------------ -- Does not support directories that begin with `-`. +- The jump function `j` does not support directories that begin with + `-`. If you want to jump a directory called `--music`, try using + `j music` instead of `j --music`. - zsh (bug \#86) diff --git a/bin/autojump.zsh b/bin/autojump.zsh index 2e1c171..57db69d 100644 --- a/bin/autojump.zsh +++ b/bin/autojump.zsh @@ -35,17 +35,10 @@ typeset -ga preexec_functions preexec_functions+=autojump_preexec function j { - if is-at-least 4.3.5; then - if [[ ${@} =~ -.* ]]; then - autojump ${@} - return - fi - else - if [[ ${@} -pcre-match -.* ]]; then - autojump ${@} - return - fi - fi + if [[ ${@} == -* ]]; then + autojump ${@} + return + fi local new_path="$(autojump $@)" if [ -d "${new_path}" ]; then diff --git a/docs/autojump.1 b/docs/autojump.1 index 88824f5..42df9f7 100644 --- a/docs/autojump.1 +++ b/docs/autojump.1 @@ -121,7 +121,10 @@ All negative key weights are purged automatically. .RE .SS KNOWN ISSUES .IP \[bu] 2 -Does not support directories that begin with \f[C]-\f[]. +The jump function \f[C]j\f[] does not support directories that begin +with \f[C]-\f[]. +If you want to jump a directory called \f[C]--music\f[], try using +\f[C]j\ music\f[] instead of \f[C]j\ --music\f[]. .IP \[bu] 2 zsh (bug #86) .RS 2 diff --git a/docs/body.md b/docs/body.md index b4c8cc3..39e3741 100644 --- a/docs/body.md +++ b/docs/body.md @@ -48,7 +48,7 @@ Options must be passed to 'autojump' and not the 'j' wrapper function. ## KNOWN ISSUES -- Does not support directories that begin with `-`. +- The jump function `j` does not support directories that begin with `-`. If you want to jump a directory called `--music`, try using `j music` instead of `j --music`. - zsh (bug #86)