Move generic formatting to a reusable function.
no warnings 'uninitialized'; # save some useless checks for more legible code
use Carp;
-our $VERSION = 'v2.00';
+our $VERSION = 'v2.01';
my @casedesc = (undef, qw/shift ctrl meta/, 'shift meta');
my @rowdesc = qw(numeric top home bottom);
} # row
}
+sub print_legend {
+ my $self = shift;
+ my ($class, $flags) = @_;
+
+ print qq{\t\t<dl class="legend $class">\n};
+ printf("\t\t".'<dt class="%s">%s'."\n\t\t\t".'<dd>%s'."\n",
+ $_, @{ $self->{flag}->{$_} || ["($_)", '...'] }
+ ) for @$flags;
+ print "\t\t</dl>";
+}
+
1;
=head1 NAME
'i^x' => "insert completion commands (i ctrl-x)",
},
+flag => {
+ ci => ["info", "Info command: shows/does something without altering anything."],
+ pm => ["motion", "Moves the cursor, or defines the range for an operator (<:= $sign{motion} :>)."],
+ po => ["positioning", "Other movement (jumps, window (re)positioning)."],
+ co => ["command", "Direct action command."],
+ mi => ["ins mode", "Enters Insert or Replace mode."],
+ mo => ["mode", "Enters a different mode."],
+ mv => ["vis mode", "Enters Visual or Select mode."],
+ me => ["key cmd", "Additional key commands (click for overview)."],
+
+ arg => ["key$sign{arg}", "Commands with a dot need a char argument afterwards."],
+ motion => ["key$sign{motion}", "Requires a motion afterwards, operates between cursor and destination."],
+ 'ext vim6' => ["vim", "Not in original Vi (assessment incomplete)."],
+ 'ext new vim7' => ["vim7", "New in vim version 7.x."],
+},
+
}
<div class="help">
<div class="left">
- <dl class="legend legend-types">
- <dt class="ci">info
- <dd>Info command: shows/does something without altering anything.
- <dt class="pm">motion
- <dd>Moves the cursor, or defines the range for an operator (<:= $sign{motion} :>).
- <dt class="po">positioning
- <dd>Other movement (jumps, window (re)positioning).
- <dt class="co">command
- <dd>Direct action command.
- <dt class="mi">ins mode
- <dd>Enters Insert or Replace mode.
- <dt class="mo">mode
- <dd>Enters a different mode.
- <dt class="mv">vis mode
- <dd>Enters Visual or Select mode.
- <dt class="me">key cmd
- <dd>Additional key commands (click for overview).
- </dl>
+<:
+ $keys->print_legend('legend-types', [qw'ci pm po co mi mo mv me']);
+:>
</div>
<div class="right">
- <dl class="legend legend-options">
- <dt>key<:= $sign{arg} :>
- <dd>Commands with a dot need a char argument afterwards.
- <dt>key<:= $sign{motion} :>
- <dd>Requires a motion afterwards, operates between cursor and destination.
- <dt class="ext vim6">vim
- <dd>Not in original Vi (assessment incomplete).
- <dt class="ext new vim7">vim7
- <dd>New in vim version 7.x.
- </dl>
+<:
+ $keys->print_legend('legend-options', [qw'arg motion', 'ext vim6', 'ext new vim7']);
+:>
<ul class="legend legend-set">
<li>keyboard <strong>map</strong> is