summaryrefslogtreecommitdiffstats
path: root/bin/clean-vim-undo
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2013-09-04 20:46:16 -0400
committerJesse Luehrs <doy@tozt.net>2013-09-04 20:46:34 -0400
commitac2fcf669aeb6e6d1013976294674977d2100fc4 (patch)
tree93a8511435032527aec593431453f658adac5f8d /bin/clean-vim-undo
parent21f3748e9e1562bf0bd3c09c4316388c56eeb373 (diff)
downloadconf-ac2fcf669aeb6e6d1013976294674977d2100fc4.tar.gz
conf-ac2fcf669aeb6e6d1013976294674977d2100fc4.zip
script to clean out my undo directory
Diffstat (limited to 'bin/clean-vim-undo')
-rwxr-xr-xbin/clean-vim-undo13
1 files changed, 13 insertions, 0 deletions
diff --git a/bin/clean-vim-undo b/bin/clean-vim-undo
new file mode 100755
index 0000000..0c234eb
--- /dev/null
+++ b/bin/clean-vim-undo
@@ -0,0 +1,13 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+
+my $undodir = "$ENV{HOME}/.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{^/};
+}