summaryrefslogtreecommitdiffstats
path: root/fish/functions/__z_clean.fish
diff options
context:
space:
mode:
Diffstat (limited to 'fish/functions/__z_clean.fish')
-rw-r--r--fish/functions/__z_clean.fish11
1 files changed, 11 insertions, 0 deletions
diff --git a/fish/functions/__z_clean.fish b/fish/functions/__z_clean.fish
new file mode 100644
index 0000000..ae1721a
--- /dev/null
+++ b/fish/functions/__z_clean.fish
@@ -0,0 +1,11 @@
+function __z_clean -d "Clean up .z file to remove paths no longer valid"
+ set -l tmpfile (mktemp $Z_DATA.XXXXXX)
+
+ if test -f $tmpfile
+ while read line
+ set -l path (string split '|' $line)[1]
+ test -d $path; and echo $line
+ end <$Z_DATA >$tmpfile
+ command mv -f $tmpfile $Z_DATA
+ end
+end