summaryrefslogtreecommitdiffstats
path: root/fish/functions/__z_clean.fish
diff options
context:
space:
mode:
authorChristoph Schlosser <cschlosser@google.com>2025-06-17 07:23:30 +0000
committerChristoph Schlosser <cschlosser@google.com>2025-06-17 07:23:30 +0000
commitd0e2daac6b87e2977b3782170f138434b22b8a62 (patch)
tree30be7cf6acbf260daf5f72f78885d7a2f3c780b8 /fish/functions/__z_clean.fish
parentf311f52b11ac29e3bddf0d0f47316cd06fa0f208 (diff)
downloaddots-d0e2daac6b87e2977b3782170f138434b22b8a62.tar.gz
Add z plugin
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