From c0c93987942dd3a86e42d20f5a9355978beca9e8 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sat, 23 Aug 2014 03:07:27 +0200 Subject: [PATCH] Handle `j -- -foo` (for bash and zsh only) Ref: #310 --- bin/autojump | 2 +- bin/autojump.bash | 10 ++++++---- bin/autojump.zsh | 10 ++++++---- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/bin/autojump b/bin/autojump index f9eaf50..565ef8b 100755 --- a/bin/autojump +++ b/bin/autojump @@ -60,7 +60,7 @@ from autojump_utils import sanitize from autojump_utils import take from autojump_utils import unico -VERSION = '22.1.1-beta' +VERSION = '22.2.0-beta' FUZZY_MATCH_THRESHOLD = 0.6 TAB_ENTRIES_COUNT = 9 TAB_SEPARATOR = '__' diff --git a/bin/autojump.bash b/bin/autojump.bash index 774cb2b..405f999 100644 --- a/bin/autojump.bash +++ b/bin/autojump.bash @@ -54,7 +54,7 @@ esac # default autojump command j() { - if [[ ${@} =~ ^-{1,2}.* ]]; then + if [[ ${1} == -* ]] && [[ ${1} != "--" ]]; then autojump ${@} return fi @@ -74,8 +74,9 @@ j() { # jump to child directory (subdirectory of current path) jc() { - if [[ ${@} == -* ]]; then + if [[ ${1} == -* ]] && [[ ${1} != "--" ]]; then autojump ${@} + return else j $(pwd) ${@} fi @@ -84,7 +85,7 @@ jc() { # open autojump results in file browser jo() { - if [[ ${@} == -* ]]; then + if [[ ${1} == -* ]] && [[ ${1} != "--" ]]; then autojump ${@} return fi @@ -116,8 +117,9 @@ jo() { # open autojump results (child directory) in file browser jco() { - if [[ ${@} == -* ]]; then + if [[ ${1} == -* ]] && [[ ${1} != "--" ]]; then autojump ${@} + return else jo $(pwd) ${@} fi diff --git a/bin/autojump.zsh b/bin/autojump.zsh index 3da3d76..4528f9c 100644 --- a/bin/autojump.zsh +++ b/bin/autojump.zsh @@ -44,7 +44,7 @@ chpwd_functions+=autojump_chpwd # default autojump command j() { - if [[ ${@} == -* ]]; then + if [[ ${1} == -* ]] && [[ ${1} != "--" ]]; then autojump ${@} return fi @@ -65,8 +65,9 @@ j() { # jump to child directory (subdirectory of current path) jc() { - if [[ ${@} == -* ]]; then + if [[ ${1} == -* ]] && [[ ${1} != "--" ]]; then autojump ${@} + return else j $(pwd) ${@} fi @@ -75,7 +76,7 @@ jc() { # open autojump results in file browser jo() { - if [[ ${@} == -* ]]; then + if [[ ${1} == -* ]] && [[ ${1} != "--" ]]; then autojump ${@} return fi @@ -108,8 +109,9 @@ jo() { # open autojump results (child directory) in file browser jco() { - if [[ ${@} == -* ]]; then + if [[ ${1} == -* ]] && [[ ${1} != "--" ]]; then autojump ${@} + return else jo $(pwd) ${@} fi