summaryrefslogtreecommitdiffstats
path: root/local/.bin/clean-vim-undo
diff options
context:
space:
mode:
Diffstat (limited to 'local/.bin/clean-vim-undo')
-rwxr-xr-xlocal/.bin/clean-vim-undo13
1 files changed, 13 insertions, 0 deletions
diff --git a/local/.bin/clean-vim-undo b/local/.bin/clean-vim-undo
new file mode 100755
index 0000000..efcd3aa
--- /dev/null
+++ b/local/.bin/clean-vim-undo
@@ -0,0 +1,13 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+
+my $undodir = "$ENV{HOME}/.cache/vim/undo";
+opendir my $undo, $undodir
+ or die "can't open $undodir: $!";
+
+for my $undofile (readdir($undo)) {
+ next unless -f "$undodir/$undofile";
+ (my $file = $undofile) =~ s{%}{/}g;
+ unlink "$undodir/$undofile" unless -e $file && $file =~ m{^/};
+}