use utf8;
use strict;
use warnings;
-no warnings "qw"; # you know what you doing
-no warnings "uninitialized"; # save some useless checks for more legible code
+no warnings 'qw'; # you know what you doing
+no warnings 'uninitialized'; # save some useless checks for more legible code
-our $VERSION = "1.0";
+our $VERSION = '1.1';
our $ascii = 0;
if (exists $get{ascii}) {
- $ascii = $get{ascii} ne "0"; # manual override
+ $ascii = $get{ascii} ne '0'; # manual override
} elsif (defined $ENV{HTTP_ACCEPT_CHARSET}) {
$ascii = 1;
- for (split ",", $ENV{HTTP_ACCEPT_CHARSET}) {
- $ascii = 0, last if $_ eq "*" or m/utf-?8/i;
+ for (split q{,}, $ENV{HTTP_ACCEPT_CHARSET}) {
+ $ascii = 0, last if $_ eq '*' or m{utf-?8}i;
}
}
-my $charset = $ascii ? "us-ascii" : "utf-8";
+my $charset = $ascii ? 'us-ascii' : 'utf-8';
my $ctype = "text/html; charset=$charset";
$header{content_type} = $ctype;
<!--[if lte IE 6]><style> .help dl.legend dt {margin:0 0 1px} </style><![endif]-->
<!--[if lte IE 7]><style> .help dl.legend dd {float:none} </style><![endif]--><:
my %styles = map {$_ => $_} qw(dark circus mono terse);
- our $style = exists $get{style} && $styles{$get{style}} || "light";
+ our $style = exists $get{style} && $styles{$get{style}} || 'light';
printf(qq{\n<link rel="%s" type="text/css" media="all" href="%s" title="%s">},
- $_ eq $style ? "stylesheet" : "alternate stylesheet", "$_.css", $_
+ $_ eq $style ? 'stylesheet' : 'alternate stylesheet', "$_.css", $_
) for keys %styles;
- our $showkeys = exists $get{keys} && $get{keys} ne "0";
+ our $showkeys = exists $get{keys} && $get{keys} ne '0';
print "\n<style> .no {visibility:hidden} </style>" unless $showkeys;
print "\n<style> .no, .alias {opacity:.5} </style>"
- if $showkeys and $get{keys} eq "ghost";
+ if $showkeys and $get{keys} eq 'ghost';
:>
<script><!--
<:
our %sign = (
- arg => $ascii ? "." : "·", # described as 'dot'
- motion => $ascii ? "|" : "↕",
- alias => $ascii ? "see: " : "»",
- up => $ascii ? "up" : "▲",
- right => $ascii ? "right" : "▶",
- down => $ascii ? "down" : "▼",
- left => $ascii ? "left" : "◀",
- sep => $ascii ? "*" : "•",
- _ => exists $get{ascii} && !$ascii ? "\x{200b}" : "<wbr>",
+ arg => $ascii ? '.' : '·', # described as 'dot'
+ motion => $ascii ? '|' : '↕',
+ alias => $ascii ? 'see: ' : '»',
+ up => $ascii ? 'up' : '▲',
+ right => $ascii ? 'right' : '▶',
+ down => $ascii ? 'down' : '▼',
+ left => $ascii ? 'left' : '◀',
+ sep => $ascii ? '*' : '•',
+ _ => exists $get{ascii} && !$ascii ? "\x{200b}" : '<wbr>',
# use the correct ZWNJ only when unicode is forced on
# default to use unofficial html for best support
);
-my %keys = do "vim-cmds.inc.pl";
+my %keys = do 'vim-cmds.inc.pl';
my @casedesc = qw(ctrl shift);
my @rowdesc = qw(numeric top home bottom);
-my %keyrows = do "vim-keys.inc.pl";
+my %keyrows = do 'vim-keys.inc.pl';
sub keyunalias {
my ($key, %tree) = @_;
return $_;
}
-our $map = defined $keyrows{$get{map}} ? $get{map} : "qwerty";
+our $map = defined $keyrows{$get{map}} ? $get{map} : 'qwerty';
my $keyrows = $keyrows{$map};
for (my $row = 0; $row <= $#$keyrows; $row++) {
printf(qq{\t<li%s><h3>%s</h3>\n}, # XXX insert here to fix msie<=6
$mode eq '' ? '' : sprintf(
- ' class="%s"', "mode mode" . escapeclass($mode)
+ ' class="%s"', 'mode mode' . escapeclass($mode)
),
sprintf('%s<small>: %s</small>',
$modekeys->{desc} || "mode $mode",
"$rowdesc[$row] row $casedesc[$case]"
)
);
- my $modeclass = "keys";
- $modeclass .= " lead" if defined $modekeys->{lead}; # leading command key shown
+ my $modeclass = 'keys';
+ $modeclass .= ' lead' if defined $modekeys->{lead}; # leading command key shown
$modeclass .= " $casedesc[$case]" if defined $casedesc[$case];
print qq{\t\t<ul class="$modeclass">\n};
for my $key (@$keycase) {
my $keyinfo = $modekeys->{$key};
- $keyinfo = [ $sign{alias}.$keyinfo, keyunalias($keyinfo)->[1] . " alias" ]
+ $keyinfo = [ $sign{alias}.$keyinfo, keyunalias($keyinfo)->[1] . ' alias' ]
if defined $keyinfo and not ref $keyinfo; # alias
my ($desc, $flags, $mnem) = @$keyinfo if defined $keyinfo;
- defined $desc or $flags = $key eq '^0' ? "ni" : "no";
+ defined $desc or $flags = $key eq '^0' ? 'ni' : 'no';
my $keytxt = $modekeys->{lead} . Entity($key) if $key ne '^0';
$keytxt .= $sign{arg} while $flags =~ s/ ?\barg\b//; # argument
$keytxt =~ s{\^(?=.)}{<small>^</small>}; # element around ctrl-identifier
my $onclick = $flags =~ s/ ?\bmode(\S*)// && defined $keys{$1} && sprintf(
' onclick="setmode(%s)"',
- $1 eq '' ? '' : sprintf("'mode%s'", escapeclass($1))
+ $1 eq '' ? '' : sprintf(q{'mode%s'}, escapeclass($1))
);
my $keyhint = defined($mnem) && qq{ title="$mnem"};
<ul class="legend legend-set">
<li>keyboard <strong>map</strong> is
- <:= $get{map} ? "set to " : "" :><em><:= $map :></em>
+ <:= $get{map} ? 'set to ' : '' :><em><:= $map :></em>
<li><strong>ascii</strong> mode is
- <:= exists $get{ascii} ? "forced " : "" :><em><:=
- $ascii ? "on" : "off" :></em>
+ <:= exists $get{ascii} ? 'forced ' : '' :><em><:=
+ $ascii ? 'on' : 'off' :></em>
<li><strong>keys</strong> are
- <em><:= $showkeys ? "always shown" : "hidden if unassigned" :></em><:=
- exists $get{keys} ? "" : " by default" :>
+ <em><:= $showkeys ? 'always shown' : 'hidden if unassigned' :></em><:=
+ exists $get{keys} ? '' : ' by default' :>
<li>default <strong>style</strong> is
- <:= defined $get{style} ? "set to " : "" :><em><:= $style :></em>
+ <:= defined $get{style} ? 'set to ' : '' :><em><:= $style :></em>
</ul>
</div>
</div>
<p class="footer">
- <a href="http://<:= $ENV{SERVER_NAME} :>/vim-cheat">shiar.demon.nl/<b>vim-cheat</b></a>
- <a href="vim-cheat.tar.gz"><:= "v$VERSION" :></a>
- created by Shiar <:= $sign{sep} :> last update <:
+ <a href="http://vi.shiar.net/">vi.<strong>shiar.net</strong></a>
+ <a href="git://dev.shiar.net/vi-cheat"><:= "v$VERSION" :></a>
+ created by Shiar <:= $sign{sep} :>
+ <a title="Licensed under the GNU Affero General Public License, version 3"
+ href="http://www.fsf.org/licensing/licenses/agpl-3.0.html">AGPLv3</a> <:= $sign{sep} :>
+ last update <:
use Time::Format qw(time_format);
- print time_format("yyyy-mm-dd", (stat "vim-cmds.inc.pl")[9]);
+ print time_format('yyyy-mm-dd', (stat 'vim-cmds.inc.pl')[9]);
:>
</p>