App-lsplusplus
view release on metacpan or search on metacpan
$no_ls_color_file .= '/' unless $no_ls_color_file =~ m{/$};
}
if($no_ls_color_file =~ m{$pattern}) {
$file = $no_ls_color_file;
if($ls_colors{$pattern} eq 'IGNORE') {
return undef;
}
# # add attributes
# # 'README$' => 'bold italic 220 underline',
for my $attr(split(/\s+/, $ls_colors{$pattern})) {
$file = fg($attr, $file);
# if several attributes are specified, the END sequence is added
# more than once. let's get rid of it so we can remove match and
# remove the trailing /
$file =~ s{(\e\[0?m)+}{$1}g;
}
}
}
# remove the trailing slash again
if (length($perm) < $permlen){
# adding an extra space to align with occasional +
$perm .= " ";
}
$perm =~ s/-/$d[1]/g;
$perm =~ s/(r)/fg($c[2], $1)/eg;
$perm =~ s/(w)/fg($c[7], $1)/eg;
$perm =~ s/(x)/fg($c[1], $1)/eg;
$perm =~ s/(d)/fg($c[16], fg('bold', $1))/eg;
$perm =~ s/(l)/fg($c[8], fg('bold', $1))/eg;
$perm =~ s/(s)/fg($c[11], $1)/eg;
$perm =~ s/(S)/fg($c[8], $1)/eg;
$perm =~ s/(t)/fg($c[8], $1)/eg;
$perm =~ s/(T)/fg($c[8], fg('bold', $1))/eg;
return $perm;
}
sub owner {
my ($user, $group) = @_;
$user = fg($c[7], $user);
$group = fg($c[8], $group);
return $user . ":". $group;
elsif($sizelen >= 8){
$stringlen = 7;
}
else
{
$stringlen = $sizelen;
}
if($size =~ m/^(\S+)(K)/) {
$size = sprintf("%27s",
fg($c[7], sprintf("%*g", $stringlen, $1))
. fg($c[2], fg('bold', $2))
);
}
elsif($size =~ m/^(\S+)(M)/) {
$size = sprintf("%29s",
fg($c[7], sprintf("%*g", $stringlen, $1))
. fg($c[9], fg('bold', $2))
);
}
elsif($size =~ m/^(\S+)(G)/) {
$size = sprintf("%27s",
fg($c[7], sprintf("%*g", $stringlen, $1))
. fg($c[3], fg('bold', $2))
);
}
elsif($size =~ m/^(\d+)/) {
$size = sprintf("%27s",
fg($c[7], sprintf("%*d", $stringlen, $1))
. fg($c[14], fg('bold', 'B'))
);
}
return $size;
}
# ANSI
else {
return sprintf("% 26s", $size)
if ($size =~ s/(.*)(K)/$c[2]$1$c[2]$c[17]$2$c[16]/);
return sprintf("% 23s", $size)
@d = qw(â - â â);
#$d[0] = 'â';
#$d[1] = ' ';
#$d[2] = 'ââ';
#$d[3] = 'â¤';
# How should symlinks be displayed?
$symlink_delim = '=>';
$symlink_color = 1;
$symlink_attr = 'bold';
# Here you can define your own custom LS_COLORS rules, much more
# powerful than the regular LS_COLORS that'll only match on an
# extension.
#
# To color (all) directories differently, match a trailing slash
# like so:
#
# '/$' => 'bold blue8 underline'
#
# Available attributes are:
# - 0-255 color index
# - any valid X color name
# - bold, underline, italic...
#
# And you can nest them too:
#
# 'README.(md|pod)$' => 'bold italic 197 underline',
#
# Remember, these rules are powerful! Match a season premiere and have
# it stand out:
#
# '(?i)(s[0-9]{2}-s[0-9]{2}|s([0-9]{1,2})[eEx]01)|([Ss]?([0-9]{1,2}))[Eex]01' => 'underline bold 196',
%ls_colors = (
'\.un~$' => 'IGNORE',
'\.sw[o-z]$' => 'IGNORE',
'README$' => 'bold 220 underline',
'Makefile$' => $c[15],
'(=:.+)?\..*rc' => $c[3],
# '/$' => 'blue8',
);
#< colorschemes
# extended colors
if($colorscheme eq '') {
$c[0] = 208;
$c[1] = 197;
8 other blue
9 hour bright blue
10 magenta
11 +s bright magenta
12 cyan
13 link bright cyan
14 B, month, delim white
15
16 reset
17 bold
=head1 AUTHOR
Magnus Woldrich
CPAN ID: WOLDRICH
m@japh.se
http://japh.se
=head1 REPORTING BUGS
( run in 2.058 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )