summaryrefslogblamecommitdiffstats
path: root/bin/clean-vim-undo
blob: efcd3aa85a0e6709d2841154e68ded183704b7b6 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
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{^/};
}