keys: move key definitions into translation includes
[sheet.git] / vi.plp
1 <(common.inc.plp)><:
2
3 Html({
4         title => 'vi cheat sheet',
5         version => '1.3',
6         description => [
7                 "Interactive cheat sheet for vi text editors, notably Vim,",
8                 "describing each key in various modes.",
9         ],
10         keywords => [qw'
11                 vi vim nvi sheet cheat reference overview commands keyboard
12         '],
13         stylesheet => [qw( light dark circus mono red )],
14         keys => 1,
15 });
16
17 :>
18 <h1>vi/vim cheat sheet</h1>
19
20 <h2>normal mode (default)</h2>
21
22 <:
23 use Shiar_Sheet::Keyboard 2;
24 my $info = do 'vi.eng.inc.pl' or die $@;
25 my $keys = Shiar_Sheet::Keyboard->new($info);
26 $keys->map($get{map}) or undef $get{map};
27 $keys->print_rows($get{rows});
28 :>
29
30 <hr>
31
32 <div class="help">
33         <div class="left">
34 <:
35                 $keys->print_legend('legend-types', ['g1' .. 'g4', 'g6' .. 'g9']);
36 :>
37         </div>
38
39         <div class="right">
40 <:
41                 $keys->print_legend('legend-options', [qw'arg motion', 'ext vim6', 'ext new vim7']);
42 :>
43
44                 <ul class="legend legend-set">
45                 <li>keyboard <strong>map</strong> is
46                         <:= $get{map} ? 'set to ' : '' :><em><:= $keys->{map} :></em>
47                 <li><strong>keys</strong> are
48                         <em><:= $showkeys ? 'always shown' : 'hidden if unassigned' :></em><:=
49                                 !defined $showkeys && ' by default' :>
50                 <li>default <strong>style</strong> is
51                         <:= defined $get{style} && 'set to ' :><em><:= $style :></em>
52                 </ul>
53         </div>
54 </div>
55