red paperclip favicon
[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 <link rel="icon" type="image/png" href="/clip.png">
27 <script type="text/javascript" src="/keys.js"></script>
28
29 <body id="vim">
30
31 <h1>vi/vim cheat sheet</h1>
32
33 <h2>normal mode (default)</h2>
34
35 <ul id="rows">
36
37 <li class="row">
38         <ul class="keys omni">
39         <li class="mo chr27" onclick="setmode()"><b>Esc</b> normal mode
40                 <!-- not as static anymore, but never bothered; just see ^[ -->
41         </ul>
42 </li>
43
44 <:
45 use Shiar_Sheet::Keyboard;
46 my $keys = Shiar_Sheet::Keyboard->new({do 'vim.inc.pl'});
47 $keys->map($get{map}) or undef $get{map};
48 $keys->print_rows($get{rows});
49 :>
50 </ul>
51
52 <hr>
53
54 <div class="help">
55         <div class="left">
56                 <dl class="legend legend-types">
57                 <dt class="ci">info
58                         <dd>Info command: shows/does something without altering anything.
59                 <dt class="pm">motion
60                         <dd>Moves the cursor, or defines the range for an operator (<:= $sign{motion} :>).
61                 <dt class="po">positioning
62                         <dd>Other movement (jumps, window (re)positioning).
63                 <dt class="co">command
64                         <dd>Direct action command.
65                 <dt class="mi">ins mode
66                         <dd>Enters Insert or Replace mode.
67                 <dt class="mo">mode
68                         <dd>Enters a different mode.
69                 <dt class="mv">vis mode
70                         <dd>Enters Visual or Select mode.
71                 <dt class="me">key cmd
72                         <dd>Additional key commands (click for overview).
73                 </dl>
74         </div>
75
76         <div class="right">
77                 <dl class="legend legend-options">
78                 <dt>key<:= $sign{arg} :>
79                         <dd>Commands with a dot need a char argument afterwards.
80                 <dt>key<:= $sign{motion} :>
81                         <dd>Requires a motion afterwards, operates between cursor and destination.
82                 <dt class="ext vim6">vim
83                         <dd>Not in original Vi (assessment incomplete).
84                 <dt class="ext new vim7">vim7
85                         <dd>New in vim version 7.x.
86                 </dl>
87
88                 <ul class="legend legend-set">
89                 <li>keyboard <strong>map</strong> is
90                         <:= $get{map} ? 'set to ' : '' :><em><:= $keys->{map} :></em>
91                 <li><strong>ascii</strong> mode is
92                         <:= defined $sign{-ascii} && 'forced ' :><em><:=
93                                 $sign{-ascii} ? 'on' : 'off' :></em>
94                 <li><strong>keys</strong> are
95                         <em><:= $showkeys ? 'always shown' : 'hidden if unassigned' :></em><:=
96                                 !exists $get{keys} && ' by default' :>
97                 <li>default <strong>style</strong> is
98                         <:= defined $get{style} && 'set to ' :><em><:= $style :></em>
99                 </ul>
100         </div>
101 </div>
102
103 <p class="footer">
104         <a href="/" rel="home">sheet.shiar.nl</a>/vim.<a href="/source/vim.plp"
105          rel="code" title="Written in Perl">plp</a>
106         <a href="http://git.shiar.nl/sheet.git/history/HEAD:/vim.plp"
107          rel="vcs-git" title="Git repository"><:= $VERSION :></a>
108         created by <a href="http://shiar.nl/" rel="author">Shiar</a> <:= $sign{sep} :>
109         <a href="http://www.fsf.org/licensing/licenses/agpl-3.0.html" rel="copyright"
110          title="Licensed under the GNU Affero General Public License, version 3">AGPLv3</a>
111 </p>
112
113 </html>