From fb42de737532ed6ef58d85484bad4c2b34b1029a Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 21 May 2025 16:10:07 +0200 Subject: [PATCH] Fix z, go to home without arg and remove non deleted folders --- fish/.config/fish/functions/__z.fish | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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