From b9115db06de9eb679d3cd040356e3103b0bcfa86 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Fri, 18 Jun 2010 22:29:37 +0000 Subject: [PATCH] vi: move legend data to translations include Move generic formatting to a reusable function. --- Shiar_Sheet/Keyboard.pm | 13 ++++++++++++- vi.eng.inc.pl | 16 ++++++++++++++++ vi.plp | 34 ++++++---------------------------- 3 files changed, 34 insertions(+), 29 deletions(-) diff --git a/Shiar_Sheet/Keyboard.pm b/Shiar_Sheet/Keyboard.pm index 7607335..7713009 100644 --- a/Shiar_Sheet/Keyboard.pm +++ b/Shiar_Sheet/Keyboard.pm @@ -5,7 +5,7 @@ use warnings; 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); @@ -168,6 +168,17 @@ sub print_rows { } # row } +sub print_legend { + my $self = shift; + my ($class, $flags) = @_; + + print qq{\t\t
\n}; + printf("\t\t".'
%s'."\n\t\t\t".'
%s'."\n", + $_, @{ $self->{flag}->{$_} || ["($_)", '...'] } + ) for @$flags; + print "\t\t
"; +} + 1; =head1 NAME diff --git a/vi.eng.inc.pl b/vi.eng.inc.pl index 9a4f6f1..7fb456b 100644 --- a/vi.eng.inc.pl +++ b/vi.eng.inc.pl @@ -459,4 +459,20 @@ mode => { '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."], +}, + } diff --git a/vi.plp b/vi.plp index f5820f1..ba92e17 100644 --- a/vi.plp +++ b/vi.plp @@ -43,37 +43,15 @@ $keys->print_rows($get{rows});
-
-
info -
Info command: shows/does something without altering anything. -
motion -
Moves the cursor, or defines the range for an operator (<:= $sign{motion} :>). -
positioning -
Other movement (jumps, window (re)positioning). -
command -
Direct action command. -
ins mode -
Enters Insert or Replace mode. -
mode -
Enters a different mode. -
vis mode -
Enters Visual or Select mode. -
key cmd -
Additional key commands (click for overview). -
+<: + $keys->print_legend('legend-types', [qw'ci pm po co mi mo mv me']); +:>
-
-
key<:= $sign{arg} :> -
Commands with a dot need a char argument afterwards. -
key<:= $sign{motion} :> -
Requires a motion afterwards, operates between cursor and destination. -
vim -
Not in original Vi (assessment incomplete). -
vim7 -
New in vim version 7.x. -
+<: + $keys->print_legend('legend-options', [qw'arg motion', 'ext vim6', 'ext new vim7']); +:>
  • keyboard map is -- 2.30.0