summaryrefslogtreecommitdiffstats
path: root/bin/clean-vim-undo
blob: 0c234ebc81aa996f15a56b2a6a7b6bcd8631a775 (plain) (blame)
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}/.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{^/};
}