script: horizontal layout
[sheet.git] / vi.plp
1 <(common.inc.plp)><:
2
3 Html({
4         title => 'vi cheat sheet',
5         version => 'v1.2',
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         charset => $sign{charset},
14         stylesheet => [qw'light dark circus mono red terse'],
15         keys => 1,
16 });
17
18 :>
19 <h1>vi/vim cheat sheet</h1>
20
21 <h2>normal mode (default)</h2>
22
23 <ul id="rows">
24
25 <li class="row">
26         <ul class="keys omni">
27         <li class="mo chr27" onclick="setmode()"><b>Esc</b> normal mode
28                 <!-- not as static anymore, but never bothered; just see ^[ -->
29         </ul>
30 </li>
31
32 <:
33 use Shiar_Sheet::Keyboard;
34 my $keys = Shiar_Sheet::Keyboard->new({do 'vi.inc.pl'});
35 $keys->map($get{map}) or undef $get{map};
36 $keys->print_rows($get{rows});
37 :>
38 </ul>
39
40 <hr>
41
42 <div class="help">
43         <div class="left">
44                 <dl class="legend legend-types">
45                 <dt class="ci">info
46                         <dd>Info command: shows/does something without altering anything.
47                 <dt class="pm">motion
48                         <dd>Moves the cursor, or defines the range for an operator (<:= $sign{motion} :>).
49                 <dt class="po">positioning
50                         <dd>Other movement (jumps, window (re)positioning).
51                 <dt class="co">command
52                         <dd>Direct action command.
53                 <dt class="mi">ins mode
54                         <dd>Enters Insert or Replace mode.
55                 <dt class="mo">mode
56                         <dd>Enters a different mode.
57                 <dt class="mv">vis mode
58                         <dd>Enters Visual or Select mode.
59                 <dt class="me">key cmd
60                         <dd>Additional key commands (click for overview).
61                 </dl>
62         </div>
63
64         <div class="right">
65                 <dl class="legend legend-options">
66                 <dt>key<:= $sign{arg} :>
67                         <dd>Commands with a dot need a char argument afterwards.
68                 <dt>key<:= $sign{motion} :>
69                         <dd>Requires a motion afterwards, operates between cursor and destination.
70                 <dt class="ext vim6">vim
71                         <dd>Not in original Vi (assessment incomplete).
72                 <dt class="ext new vim7">vim7
73                         <dd>New in vim version 7.x.
74                 </dl>
75
76                 <ul class="legend legend-set">
77                 <li>keyboard <strong>map</strong> is
78                         <:= $get{map} ? 'set to ' : '' :><em><:= $keys->{map} :></em>
79                 <li><strong>ascii</strong> mode is
80                         <:= defined $sign{-ascii} && 'forced ' :><em><:=
81                                 $sign{-ascii} ? 'on' : 'off' :></em>
82                 <li><strong>keys</strong> are
83                         <em><:= $showkeys ? 'always shown' : 'hidden if unassigned' :></em><:=
84                                 !defined $showkeys && ' by default' :>
85                 <li>default <strong>style</strong> is
86                         <:= defined $get{style} && 'set to ' :><em><:= $style :></em>
87                 </ul>
88         </div>
89 </div>
90