vimperator: keyboard cheat page
authorMischa POSLAWSKY <perl@shiar.org>
Sun, 11 Jan 2009 16:55:56 +0000 (16:55 +0000)
committerMischa POSLAWSKY <perl@shiar.org>
Tue, 3 Feb 2009 14:31:29 +0000 (14:31 +0000)
Complete Vimperator 1.12 coverage, with various modes (hints, zoom, etc)
and determined arguments: Vim modes reassigned, with one additional
style in between .co (commands) and .mi (commandish mode).

base.css
nethack.plp
red.css
vim.plp
vimperator.inc.pl
vimperator.plp [new file with mode: 0644]

index 95ba44c12da93054d615614049c1aa5e3eddde1d..366499e3283bfd70aa0798b530ff90c910bc2ed5 100644 (file)
--- a/base.css
+++ b/base.css
@@ -118,6 +118,7 @@ ul.keys.ctrl li b small { /* meta key indicator */
 .po {background: #DFA}   /* window */
 .co {background: #FFA}   /* command */
 .ci {background: #BFE}   /* info */
+.cp {background: #FDA}   /* TODO */
 .mi {background: #FCA}   /* insert mode */
 .mo {background: #FCC}   /* mode */
 .mv {background: #ECE}   /* visual mode */
index 0a5a4be588b973d93e1a5e309fe8ac4196854daa..b73a765fe4eb451226617ec2dec234293012be87 100644 (file)
@@ -70,7 +70,7 @@ function setmode(classname) {
 } // setmode
 //--></script>
 
-<body>
+<body id="nethack">
 
 <h1>NetHack cheat sheet</h1>
 
diff --git a/red.css b/red.css
index 154238b5b71f9ac1bc697db3e0cd15eea4a0bfd0..33e7f7219e5b04a28ee4311cd40f45e96dc737e3 100644 (file)
--- a/red.css
+++ b/red.css
@@ -30,12 +30,13 @@ ul.keys li b {
 .pm   {background: none} .pm b, dt.pm {color: #DD6} /* motion */
 .po   {background: none} .po b, dt.po {color: #6CD} /* window */
 .co   {background: none} .co b, dt.co {color: none} /* command */
-.mi   {background: #300} /* ins */
+.mi, .cp {background: #300} /* ins */
 .mo   {background: #600} /* state */
 .mv   {background: #600; font-style: italic} .mv b, dt.mv {color: #DD6} /* visual */
 .me   {background: #600; font-style: italic} /* mode */
 dl.legend-options dt,
 .no   {background: none} .no b {color: #000} /* unassigned */
+#vimperator .mi b, #vimperator dt.mi {color: #6CD} /* tab open */
 
 .co[onclick]:hover,
 .mi[onclick]:hover,
diff --git a/vim.plp b/vim.plp
index 3ae41b1f8ddf0b6a23527a0523de5b204b1184d4..505e34e70805b35608f56e398764a9f9822f6aa9 100644 (file)
--- a/vim.plp
+++ b/vim.plp
@@ -71,7 +71,7 @@ function setmode(classname) {
 } // setmode
 //--></script>
 
-<body>
+<body id="vim">
 
 <h1>vi/vim cheat sheet</h1>
 
index 6f18abdab9fad4df27f59828ae604d680f119b85..36cda28593c4f02c68cd114f6785556d810f574b 100644 (file)
@@ -3,99 +3,160 @@ use utf8;
 '' => {
        desc => 'normal mode',
 
-       '~' => ["open home$sign{_}dir"],
-       '@' => ["play macro", 'arg'],
-       '%' => ["to line pct", 'pm'], #TODO: G?
-       '0' => ["left of page", 'pm'],
+       '~' => ["open home$sign{_}dir", 'cp'],
+       '@' => ["play macro", 'mo arg'],
+       '^' => ["left of page", 'pm'],
+       '0' => '^',
        '$' => ["right of page", 'pm'],
        '#' => ["rev. find word", 'pm'],
        '*' => ["find word", 'pm'],
-       #'+'
-       #'`'
-       '^^'=> ["last tab"],
-       '?' => ["find rev.", 'pm arg modec'],
-       '/' => ["find", 'pm arg modec'],
-
-       'a' => ["add bookm$sign{_}ark"],
-       'A' => ["toggle bookm$sign{_}ark$sign{_}ed"],
-       '^a'=> ["increment url nr"],
-       'b' => ["to buffer"],
-       'B' => ["list buffers"],
+       '+' => 'zi',
+       '-' => 'zo',
+       '^^'=> ["last tab", 'po'],
+       '?' => ["find rev.", 'pm args modec'],
+       '/' => ["find", 'pm args modec'],
+       '[' => ["focus forw$sign{_}ard", 'me arg mode['],
+       ']' => ["focus back", 'me arg mode]'],
+       ':' => ["comm$sign{_}and line mode", 'mo args'],
+       ';' => ["extend$sign{_}ed hint$sign{_}s mode", 'me arg args mode;'],
+       "'" => ["jump to mark", 'pm'],
+       '`' => "'",
+
+       'a' => ["add bookm$sign{_}ark", 'mo args'],
+       'A' => ["toggle bookm$sign{_}ark$sign{_}ed", 'mo'],
+       '^a'=> ["incr$sign{_}em$sign{_}ent url nr", 'cp'],
+       'b' => ["to buffer", 'po args'],
+       'B' => ["list buffers", 'ci'],
        '^b'=> ["page up", 'pm'],
-       '^c'=> ["stop loading"],
-       'd' => ["close tab"],
-       'D' => ["close left tab"],
-       #'^d'
-       #'^u'
+       '^c'=> ["stop loading", 'co'],
+       '^d'=> ["scroll down", 'pm'],
+       'd' => ["close tab", 'co'],
+       'D' => ["close tab left$sign{_}ward$sign{_}s", 'co'],
+       'i' => ["caret mode", 'mv'],
        '^i'=> 'L',
        '^e'=> 'j',
-       'f' => ["quick$sign{_}hint mode", 'arg'],
-       'F' => ["f in tab", 'arg'],
+       'f' => ["quick$sign{_}hint mode", 'cp args'],
+       'F' => ["f in tab", 'mi args'],
        '^f'=> ["page down", 'pm'], # spacebar
-       'g' => ["extra cmds", 'me modeg'],
+       'g' => ["extra cmds", 'me modeg arg'],
        'G' => ["last/% line", 'pm'],
-       '^g'=> ["file name"],
+       '^g'=> ["file name", 'ci'],
        'h' => [$sign{left}, 'pm'],
-       'H' => ["page back"],
+       'H' => ["page back", 'cp'],
        'j' => [$sign{down}, 'pm'],
        'k' => [$sign{up}, 'pm'],
        'l' => [$sign{right}, 'pm'],
-       'L' => ["page forw$sign{_}ard"],
-       'M' => ["mark url", 'arg'],
-       'm' => ["mark line", 'arg'],
+       'L' => ["page forw$sign{_}ard", 'cp'],
+       'M' => ["mark url", 'mo arg'],
+       'm' => ["mark line", 'mo arg'],
        'n' => ["find next", 'pm'],
        'N' => ["find prev$sign{_}ious", 'pm'],
        '^n'=> 'gt',
-       'o' => ["open", ''],
-       'O' => ["alter url"],
+       'o' => ["open", 'cp'],
+       'O' => ["alter url", 'cp'],
        '^o'=> 'H',
-       'p' => ["open pasted url"],
-       'P' => ["p in tab"],
+       'p' => ["open pasted url", 'cp'],
+       'P' => ["p in tab", 'mi'],
        '^p'=> 'gT',
-       'q' => ["record macro", 'arg'],
-       'r' => ["reload page"],
-       'R' => ["reload uncach$sign{_}e$sign{_}d"],
-       't' => ["tab open new"],
-       'T' => ["tab open curr$sign{_}ent"],
-       '^v'=> ["pass single", 'arg'],
-       'u' => ["restore closed tab"],
-       'y' => ["copy url"],
-       'Y' => ["copy select$sign{_}ion"],
+       'q' => ["record macro", 'mv arg'],
+       'r' => ["reload page", 'co'],
+       'R' => ["reload uncach$sign{_}e$sign{_}d", 'cp'],
+       't' => ["tab open new", 'mi'],
+       'T' => ["tab open curr$sign{_}ent", 'mi'],
+       '^v'=> ["pass single", 'co arg'],
+       '^u'=> ["scroll up", 'pm'],
+       'u' => ["restore closed tab", 'mi'],
+       '^x'=> ["decr$sign{_}em$sign{_}ent url nr", 'cp'],
+       'y' => ["copy url", 'mo'],
+       'Y' => ["copy select$sign{_}ion", 'mo'],
        '^y'=> 'k',
+       'z' => ["zoom", 'ci modez arg'],
        'Z' => ["quit", 'me modeZ arg'],
-       '^z'=> ["pass throu$sign{_}gh"],
+       '^z'=> ["pass throu$sign{_}gh", 'mv'],
 }, # normal mode
 
 g => {
        desc => 'extended commands (g)',
        lead => 'g',
 
-       '0' => ["first tab"],
-       '$' => ["last tab"],
+       '0' => ["first tab", 'po'],
+       '$' => ["last tab", 'po'],
        '^' => 'g0',
 
-       'b' => ["repeat buffer cmd"],
-       'B' => ["reverse gb"],
-       'i' => ["last input field"],
-       '^g'=> ["file details"],
-       'g' => ["first line"],
-       'f' => ["view source"],
-       'F' => ["source extern$sign{_}al"],
-       'm' => ["repeat output"],
-       'n' => ["tabopen url mark", '', 'Go in New tab'],
-       'o' => ["open url mark"],
-       'P' => ["P inactive"],
-       'h' => ["open home$sign{_}page"],
-       'H' => ["tab with home$sign{_}page"],
-       'u' => ["parent dir$sign{_}ectory"],
-       'U' => ["site root"],
+       'b' => ["repeat buffer cmd", 'po'],
+       'B' => ["reverse gb", 'po'],
+       'f' => ["view source", 'cp'],
+       'F' => ["source extern$sign{_}al", 'mo'],
+       '^g'=> ["file details", 'ci'],
+       'g' => ["first line", 'pm'],
+       'h' => ["open home$sign{_}page", 'cp'],
+       'H' => ["tab with home$sign{_}page", 'mi'],
+       'i' => ["last input field", 'pm'],
+       'n' => ["tabopen url mark", 'mi arg', 'Go in New tab'],
+       'o' => ["open url mark", 'cp arg'],
+       'P' => ["$sign{alias}P inactive", 'mi'],
+       't' => ["next tab", 'po'],
+       'T' => ["prev$sign{_}ious tab", 'po'],
+       'u' => ["parent dir$sign{_}ectory", 'cp'],
+       'U' => ["site root", 'cp'],
 }, # mode g
 
+';' => {
+       desc => 'extended hints (;)',
+       lead => ';',
+
+       ';' => ["focus", 'pm'],
+       'a' => ["save prompt", 'mo args'],
+       'f' => ';o',
+       'F' => ';t',
+       'o' => ["open", 'cp'],
+       'O' => ["open prompt", 'cp args'],
+       's' => ["save", 'mo'],
+       't' => ["open in tab", 'mi'],
+       'T' => ["tab prompt", 'mi args'],
+       'v' => ["view source", 'cp'],
+       'w' => ["open in wind$sign{_}ow", 'mi'],
+       'W' => ["wind$sign{_}ow prompt", 'mi args'],
+       'y' => ["copy url", 'mo'],
+       'Y' => ["copy text", 'mo'],
+}, # mode ;
+']' => {
+       desc => '(])',
+       lead => ']',
+
+       'f' => ["next frame$sign{_}set", 'pm'],
+       ']' => ["open <q>next</q>", 'cp'],
+}, # mode ]
+
+'[' => {
+       desc => '([)',
+       lead => '[',
+
+       'f' => ["previous frame$sign{_}set", 'pm'],
+       '[' => ["open <q>prev</q>", 'cp'],
+}, # mode [
+
+z => {
+       desc => 'zoom commands (z)',
+       lead => 'z',
+
+       'i' => ["en$sign{_}large text", 'ci', 'Zoom In'],
+       'm' => ["en$sign{_}large more", 'ci', 'Zoom More'],
+       'o' => ["shrink text", 'ci', 'Zoom Out'],
+       'r' => ["tinier text", 'ci', 'Zoom Reduce'],
+       'z' => ["reset text size", 'ci', 'Zoom Zero'],
+       'I' => ["zoom in", 'ci'],
+       'M' => ["zoom more", 'ci'],
+       'O' => ["zoom out", 'ci'],
+       'R' => ["zoom out more", 'ci', 'Zoom Reduce'],
+       'Z' => ["zoom reset", 'ci', 'Zoom Zero'],
+}, # mode z
+
 Z => {
        desc => 'quit commands (Z)',
        lead => 'Z',
 
-       'Q' => ["quit no save"],
-       'Z' => ["quit save ses$sign{_}s$sign{_}ion"],
+       'Q' => ["quit no save", 'mo'],
+       'Z' => ["quit save ses$sign{_}s$sign{_}ion", 'mo'],
 }, # mode Z
 
diff --git a/vimperator.plp b/vimperator.plp
new file mode 100644 (file)
index 0000000..fe30db5
--- /dev/null
@@ -0,0 +1,172 @@
+<:
+use utf8;
+use strict;
+use warnings;
+no  warnings 'qw';  # you know what you doing
+no  warnings 'uninitialized';  # save some useless checks for more legible code
+
+our $VERSION = '1.0';
+
+our $ascii = 0;
+if (exists $get{ascii}) {
+       $ascii = $get{ascii} ne '0';  # manual override
+} elsif (defined $ENV{HTTP_ACCEPT_CHARSET}) {
+       $ascii = 1;
+       for (split q{,}, $ENV{HTTP_ACCEPT_CHARSET}) {
+               $ascii = 0, last if $_ eq '*' or m{utf-?8}i;
+       }
+}
+
+my $charset = $ascii ? 'us-ascii' : 'utf-8';
+my $ctype = "text/html; charset=$charset";
+$header{content_type} = $ctype;
+
+:><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+
+<head>
+<title>vimperator cheat sheet</title>
+<meta http-equiv="content-type" content="<:= $ctype :>">
+<link rel="stylesheet" type="text/css" media="all" href="base.css">
+<!--[if lte IE 6]><style> .help dl.legend dt {margin:0 0 1px} </style><![endif]-->
+<!--[if lte IE 7]><style> .help dl.legend dd {float:none} </style><![endif]--><:
+       my %styles = map {$_ => $_} qw(dark circus mono red terse);
+       our $style = exists $get{style} && $styles{$get{style}} || 'light';
+       printf(qq{\n<link rel="%s" type="text/css" media="all" href="%s" title="%s">},
+               $_ eq $style ? 'stylesheet' : 'alternate stylesheet', "$_.css", $_
+       ) for keys %styles;
+
+       our $showkeys = exists $get{keys} && $get{keys} ne '0';
+       print "\n<style> .no {visibility:hidden} </style>" unless $showkeys;
+       print "\n<style> .no, .alias {opacity:.5} </style>"
+               if $showkeys and $get{keys} eq 'ghost';
+:>
+<link rel="vcs" type="git" href="git://dev.shiar.nl/sheet">
+
+<script><!--
+function setmode(classname) {
+       // set style for each #rows>li>ul>li to display:none unless it matches classname
+       var showclass = classname ? ' '+classname+'(?!\\w)' : '^$';
+       var parentskip = /^keys/;
+       var row = document.getElementById('rows').firstChild;
+       do {
+               if (row.tagName == 'LI' && row.firstChild.tagName == 'UL'
+               && !row.firstChild.className.match(parentskip)) {
+                       var el = row.firstChild.firstChild;
+                       if (el) do {
+                               if (el.tagName == 'LI') {
+                                       el.style.display = el.className.match(showclass) ? 'block' : 'none';
+                               }
+                       } while (el = el.nextSibling);
+               }
+       } while (row = row.nextSibling);
+
+       // update H2 to reflect the first part of a currently active (but hidden) H3
+       var h3s = document.getElementsByTagName('H3');
+       for (var i = 0; i < h3s.length; i++) {
+               if (h3s[i].parentNode.style.display != 'block') continue;
+               document.getElementsByTagName('H2')[0].innerHTML = h3s[i].firstChild.data;
+       }
+} // setmode
+//--></script>
+
+<body id="vimperator">
+
+<h1>Vimperator cheat sheet</h1>
+
+<h2>normal mode (default)</h2>
+
+<ul id="rows">
+
+<li class="row">
+       <ul class="keys omni">
+       <li class="mv" onclick="setmode()"><b>Esc</b> normal mode
+               <!-- not as static anymore, but never bothered; just see ^[ -->
+       </ul>
+</li>
+
+<:
+our %sign = (
+       arg    => $ascii ? '.' : '·',  # described as 'dot'
+       args   => $ascii ? ':' : '⁚',  # described as 'two dots'
+       alias  => $ascii ? 'see: ' : '»',
+       up     => $ascii ? 'up'    : '▲',
+       right  => $ascii ? 'right' : '▶',
+       down   => $ascii ? 'down'  : '▼',
+       left   => $ascii ? 'left'  : '◀',
+       sep    => $ascii ? '*'     : '•',
+       _      => exists $get{ascii} && !$ascii ? "\x{200b}" : '<wbr>',
+               # use the correct ZWNJ only when unicode is forced on
+               # default to use unofficial html for best support
+);
+
+use Shiar_Sheet::Keyboard;
+my $keys = Shiar_Sheet::Keyboard->new({do 'vimperator.inc.pl'});
+$keys->map($get{map}) or undef $get{map};
+$keys->print_rows($get{static});
+:>
+</ul>
+
+<hr>
+
+<div class="help">
+       <div class="left">
+               <dl class="legend legend-types">
+               <dt class="ci">info
+                       <dd>Displays something without any permanent consequences.
+               <dt class="pm">motion
+                       <dd>Move cursor, scroll window, focus buffer element.
+               <dt class="po">tab
+                       <dd>Tab or window navigation/selection.
+               <dt class="co">buffer
+                       <dd>Page interaction.
+               <dt class="cp">open
+                       <dd>Browse to a location in the current tab.
+               <dt class="mi">tab open
+                       <dd>Browse somewhere in a new tab.
+               <dt class="mo">browser
+                       <dd>Other browser action.
+               <dt class="mv">mode
+                       <dd>Enter a different mode.
+               <dt class="me">key cmd
+                       <dd>Additional key commands (click for overview).
+               </dl>
+       </div>
+
+       <div class="right">
+               <dl class="legend legend-options">
+               <dt>key<:= $sign{arg} :>
+                       <dd>Commands with a dot need a char argument afterwards.
+               <dt>key<:= $sign{args} :>
+                       <dd>Commands with two dots require variable arguments afterwards.
+               </dl>
+
+               <ul class="legend legend-set">
+               <li>keyboard <strong>map</strong> is
+                       <:= $get{map} ? 'set to ' : '' :><em><:= $keys->{map} :></em>
+               <li><strong>ascii</strong> mode is
+                       <:= exists $get{ascii} && 'forced ' :><em><:=
+                               $ascii ? 'on' : 'off' :></em>
+               <li><strong>keys</strong> are
+                       <em><:= $showkeys ? 'always shown' : 'hidden if unassigned' :></em><:=
+                               !exists $get{keys} && ' by default' :>
+               <li>default <strong>style</strong> is
+                       <:= defined $get{style} && 'set to ' :><em><:= $style :></em>
+               </ul>
+       </div>
+</div>
+
+<p class="footer">
+       <a href="http://sheet.shiar.nl/vimperator">sheet.shiar.nl<strong>/vimperator</strong></a>
+       <a href="git://dev.shiar.nl/sheet"><:= "v$VERSION" :></a>
+       created by Shiar <:= $sign{sep} :>
+       <a title="Licensed under the GNU Affero General Public License, version 3"
+          href="http://www.fsf.org/licensing/licenses/agpl-3.0.html">AGPLv3</a> <:= $sign{sep} :>
+       last update <:
+               use Time::Format qw(time_format);
+               print time_format('yyyy-mm-dd', (stat 'vimperator.inc.pl')[9]);
+       :>
+</p>
+
+</html>