9f0c6aa16c808297d057517f1035ed02cb12931f
[sheet.git] / vim.plp
1 <(common.inc.plp)><:
2         our $VERSION = 'v1.2';
3
4         use Shiar_Sheet::KeySigns qw(%sign);  # dependant on $get{ascii}
5
6         $header{content_type} = "text/html; charset=$sign{charset}";
7
8 :><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
9  "http://www.w3.org/TR/html4/loose.dtd">
10 <html lang="en">
11
12 <head>
13 <meta http-equiv="content-type" content="<:= $header{content_type} :>">
14 <title>vi cheat sheet</title>
15 <meta name="description" content="Keyboard functionality overview sheet for the vi/Vim text editor.">
16 <meta name="keywords" content="vi, vim, nvi, sheet, cheat, reference, overview, commands, keyboard">
17 <:= stylesheet(qw'light dark circus mono red terse') :>
18 <!--[if lte IE 6]><style> .help dl.legend dt {margin:0 0 1px} </style><![endif]-->
19 <!--[if lte IE 7]><style> .help dl.legend dd {float:none} </style><![endif]--><:
20         our $showkeys = exists $get{keys} && $get{keys} ne '0';
21         print "\n".'<style type="text/css"> .no {visibility:hidden} </style>'
22                 unless $showkeys;
23         print "\n".'<style type="text/css"> .no, .alias {opacity:.5} </style>'
24                 if $showkeys and $get{keys} eq 'ghost';
25 :>
26 <script type="text/javascript" src="/keys.js"></script>
27
28 <body id="vim">
29
30 <h1>vi/vim cheat sheet</h1>
31
32 <h2>normal mode (default)</h2>
33
34 <ul id="rows">
35
36 <li class="row">
37         <ul class="keys omni">
38         <li class="mo chr27" onclick="setmode()"><b>Esc</b> normal mode
39                 <!-- not as static anymore, but never bothered; just see ^[ -->
40         </ul>
41 </li>
42
43 <:
44 use Shiar_Sheet::Keyboard;
45 my $keys = Shiar_Sheet::Keyboard->new({do 'vim.inc.pl'});
46 $keys->map($get{map}) or undef $get{map};
47 $keys->print_rows($get{rows});
48 :>
49 </ul>
50
51 <hr>
52
53 <div class="help">
54         <div class="left">
55                 <dl class="legend legend-types">
56                 <dt class="ci">info
57                         <dd>Info command: shows/does something without altering anything.
58                 <dt class="pm">motion
59                         <dd>Moves the cursor, or defines the range for an operator (<:= $sign{motion} :>).
60                 <dt class="po">positioning
61                         <dd>Other movement (jumps, window (re)positioning).
62                 <dt class="co">command
63                         <dd>Direct action command.
64                 <dt class="mi">ins mode
65                         <dd>Enters Insert or Replace mode.
66                 <dt class="mo">mode
67                         <dd>Enters a different mode.
68                 <dt class="mv">vis mode
69                         <dd>Enters Visual or Select mode.
70                 <dt class="me">key cmd
71                         <dd>Additional key commands (click for overview).
72                 </dl>
73         </div>
74
75         <div class="right">
76                 <dl class="legend legend-options">
77                 <dt>key<:= $sign{arg} :>
78                         <dd>Commands with a dot need a char argument afterwards.
79                 <dt>key<:= $sign{motion} :>
80                         <dd>Requires a motion afterwards, operates between cursor and destination.
81                 <dt class="ext vim6">vim
82                         <dd>Not in original Vi (assessment incomplete).
83                 <dt class="ext new vim7">vim7
84                         <dd>New in vim version 7.x.
85                 </dl>
86
87                 <ul class="legend legend-set">
88                 <li>keyboard <strong>map</strong> is
89                         <:= $get{map} ? 'set to ' : '' :><em><:= $keys->{map} :></em>
90                 <li><strong>ascii</strong> mode is
91                         <:= defined $sign{-ascii} && 'forced ' :><em><:=
92                                 $sign{-ascii} ? 'on' : 'off' :></em>
93                 <li><strong>keys</strong> are
94                         <em><:= $showkeys ? 'always shown' : 'hidden if unassigned' :></em><:=
95                                 !exists $get{keys} && ' by default' :>
96                 <li>default <strong>style</strong> is
97                         <:= defined $get{style} && 'set to ' :><em><:= $style :></em>
98                 </ul>
99         </div>
100 </div>
101
102 <p class="footer">
103         <a href="/" rel="home">sheet.shiar.nl</a>/vim.<a href="/source/vim.plp"
104          rel="code" title="Written in Perl">plp</a>
105         <a href="http://git.shiar.nl/sheet.git/history/HEAD:/vim.plp"
106          rel="vcs-git" title="Git repository"><:= $VERSION :></a>
107         created by <a href="http://shiar.nl/" rel="author">Shiar</a> <:= $sign{sep} :>
108         <a href="http://www.fsf.org/licensing/licenses/agpl-3.0.html" rel="copyright"
109          title="Licensed under the GNU Affero General Public License, version 3">AGPLv3</a>
110 </p>
111
112 </html>