Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 55 lines (41 sloc) 979 Bytes
#!/usr/bin/perl
use strict;
use Data::Dumper;
use Term::ExtendedColor qw(fg);
use Text::ASCIITable;
my $themes = _vim_colors( _get_vim_themes() );
my $previous;
for my $theme(sort(keys(%{$themes}))) {
my $t = Text::ASCIITable->new(
{
headingText => $theme,
},
);
$t->setOptions('allowANSI' => 1);
$t->setCols(2);
$t->setColWidth(2, 80, 1);
$t->addRow($theme);
for my $tag(sort(keys(%{$themes->{$theme}}))) {
$t->addRow($tag);
}
print $t;
}
sub _vim_colors {
my @schemes = @_;
my $theme;
for my $s(@schemes) {
open(my $fh, '<', $s) or next;
while(<$fh>) {
chomp;
next unless $_ =~ /^\s+hi /;
my($basename) = $s =~ m|.*/(.+)\.vim$|;
my($sp, $hi, $thing, $fg, $bg, $attr) = split(/\s+/, $_);
my($color) = $fg =~ m/=(\d+)$/;
$theme->{$basename}->{fg($color, $thing)} = $color;
}
}
return $theme;
}
sub _get_vim_themes {
return glob("$ENV{HOME}/configs/vim/colors/*.vim");
}