X-Git-Url: http://git.shiar.net/sheet.git/blobdiff_plain/f8c9c002006dbbaa51bd90d234e43561a9d09eff..0aaffaf050bd5ca5ce5b5caf9e8dec1e8a1b7a48:/index.plp?ds=sidebyside
diff --git a/index.plp b/index.plp
index adc573d..8897fcc 100644
--- a/index.plp
+++ b/index.plp
@@ -1,251 +1,58 @@
-<:
-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
-
-# 2006-03-29 ~20:00 started work
-# 2006-03-30 11:58 html version
-# 2006-05-20 03:44 perl version
-# 2007-02-07 07:34 cleaned up
-# 2007-02-25 04:00 v1.0: git repository
-
-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 ",", $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;
+<(common.inc.plp)><:
+ our $VERSION = 'v1.0';
:>
-
+
-vi cheat sheet
-
-
-
-<:
- my %styles = map {$_ => $_} qw(dark circus mono);
- our $style = exists $get{style} && $styles{$get{style}} || "light";
- printf(qq{\n },
- $_ eq $style ? "stylesheet" : "alternate stylesheet", "$_.css", $_
- ) for keys %styles;
-
- our $showkeys = exists $get{keys} && $get{keys} ne "0";
- print "\n" unless $showkeys;
- print "\n"
- if $showkeys and $get{keys} eq "ghost";
-:>
-
-
-
-
-
-vi/vim cheat sheet
-
-normal mode (default)
-
-
-
-
-
-
-
-<:
-our %sign = (
- arg => $ascii ? "." : "·", # described as 'dot'
- motion => $ascii ? "|" : "â",
- alias => $ascii ? "see: " : "»",
- up => $ascii ? "up" : "â²",
- right => $ascii ? "right" : "â¶",
- down => $ascii ? "down" : "â¼",
- left => $ascii ? "left" : "â",
- sep => $ascii ? "*" : "â¢",
- _ => exists $get{ascii} && !$ascii ? "\x{200b}" : "",
- # use the correct ZWNJ only when unicode is forced on
- # default to use unofficial html for best support
-);
-
-my %keys = do "vim-cmds.inc.pl";
-
-my @casedesc = qw(ctrl shift);
-my @rowdesc = qw(numeric top home bottom);
-my %keyrows = do "vim-keys.inc.pl";
-
-sub keyunalias {
- my ($key, %tree) = @_;
- $key =~ s/(\S*?)(\^?\S)($|\s.*)/$2/;
- my $mode = $1;
- return [] unless defined $keys{$mode}{$key};
- return $keys{$mode}{$key} if ref $keys{$mode}{$key};
- return if $tree{$key}++; # endless loop failsafe
- return keyunalias($keys{$mode}{$key}, %tree);
-}
-
-sub escapeclass {
- local $_ = shift;
- s/\^/_c/g;
- s/\[/_sbo/g;
- s/\]/_sbc/g;
- s/^$/_/;
- return $_;
-}
-
-our $map = defined $keyrows{$get{map}} ? $get{map} : "qwerty";
-my $keyrows = $keyrows{$map};
-
-for (my $row = 0; $row <= $#$keyrows; $row++) {
- my $keyrow = $keyrows->[$row];
- print qq{\n};
- while (my ($mode, $modekeys) = each %keys) {
- for (my $case = 0; $case <= $#$keyrow; $case++) {
- my $keycase = $keyrow->[$case];
- @$keycase or next;
-
- printf(qq{\t%s \n}, # XXX insert here to fix msie<=6
- $mode eq '' ? '' : sprintf(
- ' class="%s"', "mode mode" . escapeclass($mode)
- ),
- sprintf('%s: %s ',
- $modekeys->{desc} || "mode $mode",
- "$rowdesc[$row] row $casedesc[$case]"
- )
- );
- my $modeclass = "keys";
- $modeclass .= " lead" if defined $modekeys->{lead}; # leading command key shown
- $modeclass .= " $casedesc[$case]" if defined $casedesc[$case];
- print qq{\t\t\n};
-
- for my $key (@$keycase) {
- my $keyinfo = $modekeys->{$key};
- $keyinfo = [ $sign{alias}.$keyinfo, keyunalias($keyinfo)->[1] . " alias" ]
- if defined $keyinfo and not ref $keyinfo; # alias
- my ($desc, $flags, $mnem) = @$keyinfo if defined $keyinfo;
- defined $desc or $flags = $key eq '^0' ? "ni" : "no";
-
- my $keytxt = $modekeys->{lead} . Entity($key) if $key ne '^0';
- $keytxt .= $sign{arg} while $flags =~ s/ ?\barg\b//; # argument
- $keytxt .= "$sign{motion} " if $flags =~ s/ ?\bargm\b//; # motion argument
- $keytxt =~ s{\^(?=.)}{^ }; # element around ctrl-identifier
- my $onclick = $flags =~ s/ ?\bmode(\S*)// && defined $keys{$1} && sprintf(
- ' onclick="setmode(%s)"',
- $1 eq '' ? '' : sprintf("'mode%s'", escapeclass($1))
- );
- my $keyhint = defined($mnem) && qq{ title="$mnem"};
-
- print qq{\t\t$keytxt };
- print ' ', $desc if defined $desc;
- print "\n";
- } # key
-
- print qq{\t\t \n};
- } # case
-
- } # mode
- print qq{\t \n};
-} # row
+
+cheat sheets
+
+
+<:= stylesheet(qw'light dark red') :>
+
+
+
+
+
+Shiar's cheat sheets
+
+
+Through the miracle of formatting, design, abbreviation, compression, and Perl,
+the following topics have been condensed into single pages of reference.
+
+Originally created by Mischa Poslawsky ,
+but you're free to use, print, alter, and redistribute under the AGPL license.
+
-:>
+
-
-
-
-
-
- info
- Info command: shows/does something without altering anything.
- motion
- Moves the cursor, or defines the range for an operator (<:= $sign{motion} :>).
- positioning
- Other movement (jumps, window (re)positioning).
- command
- Direct action command.
- ins mode
- Enters Insert or Replace mode.
- mode
- Enters a different mode.
- vis mode
- Enters Visual or Select mode.
- key cmd
- Additional key commands (click for overview).
-
-
-
-
-
- key<:= $sign{arg} :>
- Commands with a dot need a char argument afterwards.
- key<:= $sign{motion} :>
- Requires a motion afterwards, operates between cursor and destination.
- vim
- Not in original Vi (assessment incomplete).
- vim7
- New in vim version 7.x.
-
-
-
- keyboard map is
- <:= $get{map} ? "set to " : "" :><:= $map :>
- ascii mode is
- <:= exists $get{ascii} ? "forced " : "" :><:=
- $ascii ? "on" : "off" :>
- keys are
- <:= $showkeys ? "always shown" : "hidden if unassigned" :> <:=
- exists $get{keys} ? "" : " by default" :>
- default style is
- <:= defined $get{style} ? "set to " : "" :><:= $style :>
-
-
+
-