From 55f4eacc8a609e9717fbf5a59181d783c1d8be9b Mon Sep 17 00:00:00 2001 From: David Frascone Date: Tue, 9 Jun 2015 14:42:44 -0600 Subject: [PATCH] If autojump can't find the directory, attempt a cd --- bin/autojump.fish | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/bin/autojump.fish b/bin/autojump.fish index 19cb27e..ead7ea1 100644 --- a/bin/autojump.fish +++ b/bin/autojump.fish @@ -49,15 +49,20 @@ function j autojump $argv case '*' set -l output (autojump $argv) - if test -d "$output" - set_color red - echo $output - set_color normal - cd $output + # Check for . and attempt a regular cd + if [ $output = "." ] + cd $argv else - __aj_err "autojump: directory '"$argv"' not found" - __aj_err "\n$output\n" - __aj_err "Try `autojump --help` for more information." + if test -d "$output" + set_color red + echo $output + set_color normal + cd $output + else + __aj_err "autojump: directory '"$argv"' not found" + __aj_err "\n$output\n" + __aj_err "Try `autojump --help` for more information." + end end end end