diff --git a/fish/.config/fish/functions/__z.fish b/fish/.config/fish/functions/__z.fish index f72ff0e..5b9cb20 100644 --- a/fish/.config/fish/functions/__z.fish +++ b/fish/.config/fish/functions/__z.fish @@ -140,7 +140,11 @@ function __z -d "Jump to a recent directory." return end - set target (command awk -v t=(date +%s) -v typ="$typ" -v q="$q" -F "|" $z_script "$Z_DATA") + if set -q q[1] + set target (command awk -v t=(date +%s) -v typ="$typ" -v q="$q" -F "|" $z_script "$Z_DATA") + else + set target (path resolve $HOME) + end if test "$status" -gt 0 return @@ -168,7 +172,11 @@ function __z -d "Jump to a recent directory." type -q open; and open "$target"; and return $status echo "Not sure how to open file manager"; and return 1 end - else + else if test -d $target pushd "$target" + else + echo "Folder '$target' does not exist anymore, removing from z_data" + sed -i -e "\:^$target|.*:d" $Z_DATA + __z $argv end end