5 no warnings 'qw'; # you know what you doing
6 no warnings 'uninitialized'; # save some useless checks for more legible code
8 use Shiar_Sheet::KeySigns qw(%sign); # dependant on $get{ascii}
12 $header{content_type} = "text/html; charset=$sign{charset}";
14 :><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
15 "http://www.w3.org/TR/html4/loose.dtd">
19 <title>vi cheat sheet</title>
20 <meta http-equiv="content-type" content="<:= $header{content_type} :>">
21 <link rel="stylesheet" type="text/css" media="all" href="base.css">
22 <!--[if lte IE 6]><style> .help dl.legend dt {margin:0 0 1px} </style><![endif]-->
23 <!--[if lte IE 7]><style> .help dl.legend dd {float:none} </style><![endif]--><:
24 my %styles = map {$_ => $_} qw(dark circus mono red terse);
25 our $style = exists $get{style} && $styles{$get{style}} || 'light';
26 printf(qq{\n<link rel="%s" type="text/css" media="all" href="%s" title="%s">},
27 $_ eq $style ? 'stylesheet' : 'alternate stylesheet', "$_.css", $_
30 our $showkeys = exists $get{keys} && $get{keys} ne '0';
31 print "\n<style> .no {visibility:hidden} </style>" unless $showkeys;
32 print "\n<style> .no, .alias {opacity:.5} </style>"
33 if $showkeys and $get{keys} eq 'ghost';
35 <script type="text/javascript" src="/keys.js"></script>
39 <h1>vi/vim cheat sheet</h1>
41 <h2>normal mode (default)</h2>
46 <ul class="keys omni">
47 <li class="mo chr27" onclick="setmode()"><b>Esc</b> normal mode
48 <!-- not as static anymore, but never bothered; just see ^[ -->
53 use Shiar_Sheet::Keyboard;
54 my $keys = Shiar_Sheet::Keyboard->new({do 'vim.inc.pl'});
55 $keys->map($get{map}) or undef $get{map};
56 $keys->print_rows($get{static});
64 <dl class="legend legend-types">
66 <dd>Info command: shows/does something without altering anything.
68 <dd>Moves the cursor, or defines the range for an operator (<:= $sign{motion} :>).
69 <dt class="po">positioning
70 <dd>Other movement (jumps, window (re)positioning).
71 <dt class="co">command
72 <dd>Direct action command.
73 <dt class="mi">ins mode
74 <dd>Enters Insert or Replace mode.
76 <dd>Enters a different mode.
77 <dt class="mv">vis mode
78 <dd>Enters Visual or Select mode.
79 <dt class="me">key cmd
80 <dd>Additional key commands (click for overview).
85 <dl class="legend legend-options">
86 <dt>key<:= $sign{arg} :>
87 <dd>Commands with a dot need a char argument afterwards.
88 <dt>key<:= $sign{motion} :>
89 <dd>Requires a motion afterwards, operates between cursor and destination.
91 <dd>Not in original Vi (assessment incomplete).
93 <dd>New in vim version 7.x.
96 <ul class="legend legend-set">
97 <li>keyboard <strong>map</strong> is
98 <:= $get{map} ? 'set to ' : '' :><em><:= $keys->{map} :></em>
99 <li><strong>ascii</strong> mode is
100 <:= defined $sign{-ascii} && 'forced ' :><em><:=
101 $sign{-ascii} ? 'on' : 'off' :></em>
102 <li><strong>keys</strong> are
103 <em><:= $showkeys ? 'always shown' : 'hidden if unassigned' :></em><:=
104 !exists $get{keys} && ' by default' :>
105 <li>default <strong>style</strong> is
106 <:= defined $get{style} && 'set to ' :><em><:= $style :></em>
112 <a href="http://sheet.shiar.nl/" rel="home">sheet.shiar.nl</a>/vim
113 <a href="git://dev.shiar.nl/sheet" rel="vcs-git" title="Git repository"><:= "v$VERSION" :></a>
114 created by <a href="http://shiar.nl/" rel="author">Shiar</a> <:= $sign{sep} :>
115 <a title="Licensed under the GNU Affero General Public License, version 3" rel="copyright"
116 href="http://www.fsf.org/licensing/licenses/agpl-3.0.html">AGPLv3</a> <:= $sign{sep} :>
118 use Time::Format qw(time_format);
119 print time_format('yyyy-mm-dd', (stat 'vim.inc.pl')[9]);