+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.
+
<:
-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 $_;
-}
-
-my %keytrans = qw(
- ^@ NUL ^a SOH ^b STX ^c ETX ^d EOT ^e ENQ ^f ACK ^g BEL
- ^h BS ^i tab ^j LF ^k VT ^l FF ^m CR ^n SO ^o SI
- ^p DLE ^q DC1 ^r DC2 ^s DC3 ^t DC4 ^u NAK ^v SYN ^w ETB
- ^x CAN ^y EM ^z SUB ^[ ESC ^\ FS ^] GS ^^ RS ^_ US
- ^? DEL
-);
-
-sub print_key {
- my ($mode, $key, $keyinfo) = @_;
-
- $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';
-
-# $key = $keytrans{$key} if defined $keytrans{$key};
- my $keytxt = $mode . 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(q{'mode%s'}, escapeclass($1))
- );
- $onclick .= sprintf(q{ onclick="document.location='%s'"}, $1)
- if $flags =~ s/ ?\blink(\S*)//;
- my $keyhint = defined($mnem) && qq{ title="$mnem"};
-
- print qq{\t\t