From: Mischa POSLAWSKY Date: Sat, 24 Feb 2007 23:10:56 +0000 (+0100) Subject: vim keyboard page (initial commit) X-Git-Tag: v1.0~2 X-Git-Url: http://git.shiar.nl/sheet.git/commitdiff_plain/8da111b671c9914450077a1ec506964e70dceb40 vim keyboard page (initial commit) --- 8da111b671c9914450077a1ec506964e70dceb40 diff --git a/base.css b/base.css new file mode 100644 index 0000000..40d0cb1 --- /dev/null +++ b/base.css @@ -0,0 +1,209 @@ +body { + background: #FFF; + color: #000; + font-size: 90%; +} +a, a:visited { + color: #000; + text-decoration: underline; +} +a:active, a:hover { + color: #00F; + text-decoration: none; +} +h1, h2 { + text-align: center; + font-size: 200%; + margin: 0; +} +h2 { + font-size: 125%; + margin-bottom: -4ex; +} + +/* "keyboard" (list of keys) */ + +ul { + margin: 0; + padding: 0; + list-style: none; +} +li.row1 {margin-left: 7em} /* row offsets relative to ~6em key width */ +li.row2 {margin-left: 8em} +li.row3 {margin-left: 10em} /* should actually align to next key on row0 */ + /* ...however rows>=1 are shifted a bit, to make space */ + +li.row { + clear: both; /* start new row block (keyboard row) */ + padding-top: 1ex; +} +li.row > ul > li { + clear: both; /* start new row (screen row) */ +} /* css2 selectors ignored by msie<=6 */ +li.row ul ul { + clear: both; +} /* css1 alternative as well (doesn't match in gecko for some reason) */ + +h3 {display: none} /* semantic details (non-css/js) */ +li.mode {display: none} /* initially hidden (only show interactively (js)) */ + +/* individual keys */ + +dl.legend dt, +ul.keys li { + float: left; + width: 6.2em; + line-height: 2.25ex; /* a little terser (seems to be gecko's default anyway) */ + height: 4.5ex; /* 2 lines */ + overflow: hidden; + margin: 0 2px -1px; + text-align: center; + border: 1px solid #000; + border-radius: 4px; + -moz-border-radius: 4px; +} +ul.keys li b { + float: left; + font-size: 200%; + line-height: 2.5ex; /* inherits otherwise */ + padding-left: 2px; +} +ul.keys.omni li { + width: 8.5em; +} + +/* fine tuning of special occurrences */ + +ul.keys li b[title] { /* mnemonic hover */ + cursor: help; +} +ul.keys li[onclick]:hover { /* link */ + cursor: pointer; +} +ul.keys.ctrl li b, +ul.keys.lead li b { /* char with ctrl or leading key */ + font-size: 100%; /* space is too limited for 2+ double-sized chars */ + line-height: 5ex; /* keep double height though */ +} +ul.keys.ctrl li b small { /* meta key indicator */ + font-size: 70%; + font-weight: normal; /* nice and subtle */ +} + +/* key type colorization */ + +.pm {background: #BFB} /* motion */ +.po {background: #DFA} /* window */ +.co {background: #FFA} /* command */ +.ci {background: #BFE} /* info */ +.mi {background: #FCA} /* insert mode */ +.mo {background: #FCC} /* mode */ +.mv {background: #ECE} /* visual mode */ +.me {background: #CCF} /* key mode */ + +.mi[onclick]:hover {background: #F97} +.mo[onclick]:hover {background: #F88} +.me[onclick]:hover {background: #99F} +.mv[onclick]:hover {background: #D9D} + +.no { + background: #EEE; +} +ul.keys li.ni { + border: 0; + padding: 1px; /* same size as borderlessless keys */ +} + +dl.legend dt.vim, +ul.keys li.vim { + border-style: dashed; + -moz-border-radius: 0; /* incompatible with border-style */ +} +dl.legend dt.vim7, +ul.keys li.vim7 { + border-style: dotted; + -moz-border-radius: 0; +} + +/* footer */ + +hr { + clear: both; + visibility: hidden; + height: 2ex; + margin: 0; +} + +p.footer { + margin: 0; + text-align: center; +} + +/* l/r help columns */ + +.help { + display: table; + width: 100%; +} +.help > * { + display: table-cell; + width: 20%; +} + +.left dl.legend { + margin-left: 6.2em; +} +.left dl.legend dt { + margin-left: -6.2em; /* msie<=6 multiply this by two for some reason */ + float: left; + clear: left; +} +.left dl.legend dd { + float: left; /* align next to dt (except msie<=7 does just the opposite) */ +} +.right dl.legend { + margin-right: 6.2em; +} +.right dl.legend dt { + margin-right: -6.2em; + float: right; + clear: right; +} +.right dl.legend dd { + float: right; +} +.right { + text-align: right; +} + +/* help/legend */ + +dl.legend dt { + margin: 0 0 1px; /* distinct keys */ + height: auto; /* not key-height */ + padding: 2px 0; +} +dl.legend dd { + margin: 3px 0.4em 0; /* align text (add dt border+padding height) */ +} + +dl.legend-options dt { + background: #CCC; +} + +ul.legend-set { + clear: right; + padding-top: 1ex; +} +ul.legend-set li { + margin: 6px 0; /* similar to dl legends */ +} + +/* printing hints */ + +@page {size: landscape} + +@media print { + ul.legend-set {display: none} +} + diff --git a/circus.css b/circus.css new file mode 100644 index 0000000..84acc95 --- /dev/null +++ b/circus.css @@ -0,0 +1,14 @@ +.pm {background: #8F8} /* motion */ +.po {background: #CF8} /* window */ +.co {background: #FF8} /* command */ +.ci {background: #8FD} /* info */ +.mi {background: #FB8} /* insert mode */ +.mo {background: #F77} /* mode */ +.mv {background: #E8E} /* visual mode */ +.me {background: #99F} /* key mode */ + +/* hovers todo */ +.mo[onclick]:hover { + background: #FCC; +} + diff --git a/dark.css b/dark.css new file mode 100644 index 0000000..6f1feb4 --- /dev/null +++ b/dark.css @@ -0,0 +1,30 @@ +body { + background: #000; + color: #CCC; +} +a, a:visited { + color: #BBB; +} + +dl.legend dt, +ul.keys li { + border-color: #888; +} +dl.legend-options dt {background: #333} + +.pm {background: #040} /* motion */ +.po {background: #340} /* window */ +.ci {background: #044} /* info */ +.co {background: #440} /* command */ +.mi {background: #530} /* ins */ +.mo {background: #500} /* state */ +.mv {background: #503} /* visual */ +.me {background: #205} /* mode */ + +.mi[onclick]:hover, +.mo[onclick]:hover, +.mv[onclick]:hover, +.me[onclick]:hover { + color: #000; /* on default (light) background hover */ +} /* mode link */ + diff --git a/index.plp b/index.plp new file mode 100644 index 0000000..096a35f --- /dev/null +++ b/index.plp @@ -0,0 +1,261 @@ +<: +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 + +# TODO: +# - use js to detect optimal key size +# - style for .undo (maybe just some css3-only shadow) +# - fix mode switching in konq (used to work) +# only when s present?! use browser sniffing to force ?ascii=0 :( +# - safari loading bug? +# - good case for gzip compression +# - link to source tarball +# - default stylesheet selectable +# - catch and execute pressed keys +# - ghosting option documented and default +# - option to follow aliases (default on?) +# - custom row combinations (eg for comparing different modes) + +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; + +:> + + + +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)

+ + + +
+ +
+
+
+
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 :> +
+
+
+ + + + diff --git a/mono.css b/mono.css new file mode 100644 index 0000000..5e6168b --- /dev/null +++ b/mono.css @@ -0,0 +1,17 @@ +dl.legend-options dt {background: #EEE} + +.pm {background: #FFF} /* motion */ +.po {background: #DDD} /* window */ +.co {background: #AAA} /* command */ +.ci {background: #777} /* info */ +.mi {background: #888; color: #FFF} /* insert mode */ +.mv {background: #444; color: #FFF} /* visual mode */ +.mo {background: #000; color: #FFF} /* mode */ +.me {background: #000; color: #AAA} /* key mode */ + +ul.keys li[onclick]:hover { + background: #888; + color: #000; + border-color: #444; +} + diff --git a/vim-cheat.html b/vim-cheat.html new file mode 100644 index 0000000..9b3330d --- /dev/null +++ b/vim-cheat.html @@ -0,0 +1,706 @@ + + + + + +vi/vim cheat sheet + + + + + + +

vi/vim cheat sheet

+ + + +
+
+
motion
Moves the cursor, or defines the range for an operator. +
command
Direct action command, if red, it enters insert mode. +
operator
Requires a motion afterwards, operates between cursor and destination. +
mode +
q·
Commands with a dot need a char argument afterwards. +
+
+ + diff --git a/vim-cheat.tar.gz b/vim-cheat.tar.gz new file mode 100644 index 0000000..0e6e7b4 Binary files /dev/null and b/vim-cheat.tar.gz differ diff --git a/vim-cmds.inc.pl b/vim-cmds.inc.pl new file mode 100644 index 0000000..bc05a94 --- /dev/null +++ b/vim-cmds.inc.pl @@ -0,0 +1,523 @@ +use utf8; + +'' => { + desc => "normal mode", + + '~' => ["toggle case", "co undo"], + '!' => ["extern$sign{_}al filter", "co argm undo modec"], + '@' => ["play macro", "co arg undo"], + '#' => ["rev. find word", "pm vim"], + '$' => ["eol", "pm"], + '%' => ["goto match", "pm"], + '^' => ['"soft" bol', "pm"], + '&' => ["repeat :s", "co undo"], + '*' => ["find word", "pm vim"], + '(' => ["begin sentence", "pm"], + ')' => ["end sentence", "pm"], + '_' => ['"soft" bol down', "pm"], + '+' => ["next line", "pm"], + '`' => ["goto mark", "pm arg"], + '0' => ['"hard" bol', "pm"], + '^^'=> ["edit alt. file", "co"], + '-' => ["prev line", "pm"], + '=' => ["auto form$sign{_}at", "co argm undo"], + '?' => ["find rev.", "pm arg modec"], + ';' => ["repeat t/T/f/F", "pm"], + ':' => ["ex cmd line", "co modec"], + "'" => ["goto mark bol", "pm arg"], + '"' => ["use register", "co arg"], + '\\' => ["not used", "me arg"], + '^\\' => ["to mode/$sign{_}ext$sign{_}ens$sign{_}ion$sign{_}s", "mo arg"], + ',' => ["reverse t/T/f/F", "pm"], + '<' => ["un­$sign{_}indent", "co argm undo"], + '.' => ["repeat cmd", "co undo"], + '>' => ["ident", "co argm undo"], + '/' => ["find", "pm arg modec"], + '[' => ["move back$sign{_}ward$sign{_}s", "me arg mode["], + '{' => ["begin parag.", "pm"], + ']' => ["move forw$sign{_}ard", "me arg mode]"], + '}' => ["end parag.", "pm"], + '^]'=> ["go to tag", "po"], + '|' => ["bol/$sign{_}goto col", "pm"], + + 'a' => ["append", "mi undo modei"], + 'A' => ["append to eol", "mi undo modei"], + '^a'=> ["incr$sign{_}ement", "co undo", "Add one"], + 'b' => ["prev word", "pm", "Back"], + 'B' => ['prev word', "pm"], + '^b'=> ["page up", "pm"], + 'c' => ["change", "mi argm undo modei"], + 'C' => ["change to eol", "mi undo modei"], + '^c'=> ["abort", "co"], + 'd' => ["delete", "co argm undo"], + 'D' => ["delete to eol", "co undo"], + '^d'=> ["scroll down", "po"], + 'e' => ["end word", "pm"], + 'E' => ['end word', "pm"], + '^e'=> ["window down", "po", "Extra line"], + 'f' => ["fwd to char", "pm arg"], + 'F' => ['backwd to char', "pm arg"], + '^f'=> ["page down", "pm", "page Forward"], + 'g' => ["extra cmds", "me arg modeg"], + 'G' => ["eof/$sign{_}goto ln", "pm"], + '^g'=> [":file (info)", "ci"], + 'h' => [$sign{left}, "pm"], + 'H' => ["screen top", "pm"], + '^h'=> "h", + 'i' => ["insert mode", "mi undo modei"], + 'I' => ["insert at bol", "mi undo modei"], + '^i'=> ["jump to newer", "pm"], + 'j' => [$sign{down}, "pm"], + 'J' => ["join lines", "co undo"], + '^j'=> "j", + 'k' => [$sign{up}, "pm"], + 'K' => ["help", "co", "looKup Keyword"], + 'l' => [$sign{right}, "pm"], + 'L' => ["screen bottom", "pm", "Lowermost Line"], + '^l'=> ["redraw", "ci"], + 'm' => ["set mark", "co arg"], + 'M' => ["screen mid'l", "pm"], + '^m'=> "+", + 'n' => ["next find", "pm"], + 'N' => ["prev find", "pm"], + '^n'=> "j", + 'o' => ["open below", "mi undo modei"], + 'O' => ["open above", "mi undo modei"], + '^o'=> ["jump to older", "pm"], + 'p' => ["paste after", "co undo"], + 'P' => ["paste before", "co undo"], + '^p'=> "k", + 'q' => ["record macro", "mo arg", "Queue seQuence"], + 'Q' => ["ex mode", "mo"], + '^q'=> ["(xon)", "ci"], # or ^v + 'r' => ["replace char", "co arg undo"], + 'R' => ["replace mode", "mi undo modei"], + '^r'=> ["redo", "co undo"], + 's' => ["subst char", "mi undo modei"], + 'S' => ["subst line", "mi undo modei"], + '^s'=> ["(xoff)", "ci"], + 't' => ["till char", "pm arg"], + 'T' => ["back till char", "pm"], + '^t'=> ["previous tag", "po"], + 'u' => ["undo", "co undo"], + 'U' => ["undo line", "co undo"], + '^u'=> ["scroll up", "po"], + 'v' => ["visual mode", "mv modev"], + 'V' => ["visual lines", "mv modev"], + '^v'=> ["visual block", "mv modev"], + 'w' => ["next word", "pm"], + 'W' => ['next word', "pm"], + '^w'=> ["window cmds", "me arg mode^w"], + 'x' => ["delete char", "co undo"], + 'X' => ["back­$sign{_}space", "co undo"], + '^x'=> ["subs$sign{_}tract", "co undo"], + 'y' => ["yank", "co argm"], + 'Y' => ["yank line", "co"], + '^y'=> ["window up", "po"], + 'z' => ["extra cmds", "me arg modez"], + 'Z' => ["quit", "me arg modeZ"], + '^z'=> [":sus$sign{_}pend", "ci"], +}, # normal mode + +g => { + desc => "extended commands (g)", + lead => "g", + + '~' => ["toggle case", "co argm vim"], + '@' => ["operat$sign{_}or$sign{_}func", "co vim7"], + '#' => ["rev. find string", "pm vim"], + '$' => ["virt$sign{_}ual eol", "pm"], + '^' => [qq'"soft" bol v$sign{_}irt$sign{_}ual', "pm vim"], + '&' => ["repeat :s global$sign{_}ly", "co", "Global substitute"], + '*' => ["find string", "pm vim"], + '_' => [qq'"soft" eol', "pm vim"], + '+' => ["later undo", "co vim7"], + '`' => ["to mark keepj$sign{_}umps", "pm vim arg"], + '8' => ["char hex val$sign{_}ue$sign{_}s", "ci"], + '0' => ["virtual bol", "pm vim"], + '-' => ["earlier undo", "co vim7"], + '^['=> ["esc", "mo mode"], + ']' => ["go to tselect", "po"], + '^]'=> ["go to tjump", "po"], + ';' => ["to prev change pos", "pm"], + "'" => ["to mark keepj$sign{_}umps", "pm vim arg"], + '<' => ["see prev cmd output", "co vim7"], + '?' => ["rot13 encode", "co argm vim"], + ',' => ["to next change pos", "pm"], + + 'a' => ["char value", "ci", "Get Ascii value"], + '^a'=> ["mem usage stats", "ci"], + 'd' => ["local declar$sign{_}ation", "pm vim"], + 'D' => ["global declar$sign{_}ation", "pm vim"], + 'e' => ["back to word end", "pm"], + 'E' => [qq'back to word end', "pm"], + 'f' => ["edit file at cur$sign{_}sor", "co vim", "Goto File"], + 'F' => ["edit file + jump", "co vim7"], + 'g' => ["first line", "pm"], + '^g'=> ["cursor pos info", "ci"], + 'h' => ["select mode", "mv modev", "Get Highlighted"], + 'H' => ["select lines", "mv modev", "Get Highlighted"], + '^h'=> ["select block", "mv modev", "Get Highlighted"], + 'i' => ["insert at last pos", "mi undo modei"], + 'I' => ["insert at soft bol", "mi undo modei"], + 'j' => ["display line down", "pm vim"], + 'J' => ["join leave spac$sign{_}ing", "co"], + 'k' => ["display line up", "pm vim"], + 'm' => ["g0 right half scr$sign{_}een", "pm vim"], + 'o' => [":goto (byte)", "pm"], + 'p' => ["paste no move", "co undo"], + 'P' => ["paste before no move", "co"], + 'q' => ["format", "co argm"], + 'Q' => ["ex mode manual :", "mo vim"], + 'r' => ["replace char vir.", "co arg"], + 'R' => ["replace mode v$sign{_}ir$sign{_}t$sign{_}ual", "mi undo modei"], + 's' => ["sleep", "ci", "Go to Sleep"], + 't' => ["next tab", "po vim7", "Goto Tab"], + 'T' => ["previous tab", "po vim7"], + 'u' => ["lower$sign{_}case", "co argm vim"], # XXX undo? + 'U' => ["upper$sign{_}case", "co undo argm vim"], + 'v' => ["previous visual mode", "mv modev", "precedinG Visual"], + 'V' => ["avoid reselect$sign{_}ion", "co"], + 'w' => ["format remain cursor", "co argm vim7"], + 'x' => ["Netrw$sign{_}BrowseX", "co vim7"], +}, # mode g + +Z => { + desc => "additional commands (z)", + lead => "Z", + + '^['=> ["esc", "mo mode"], + + 'Q' => [" :q!", "co vim"], + 'Z' => [" :wq", "co"], +}, # mode Z + +z => { + desc => "quit commands", + lead => "z", + + '^' => ["page above", "po"], + '+' => ["page below", "po"], + '-' => ["line at bottom bol", "po", "don't (-) see any further"], + '=' => ["spelling suggest$sign{_}ions", "co vim7"], + '.' => ["line at center bol", "po"], + '^['=> ["esc", "mo mode"], + + 'a' => ["toggle fold", "co vim folding"], + 'A' => ["toggle fold rec$sign{_}urs$sign{_}ive$sign{_}ly", "co vim folding"], + 'b' => ["line at bot. bol", "po"], + 'c' => ["close fold", "co vim folding"], + 'C' => ["close folds rec$sign{_}curs$sign{_}ive$sign{_}ly", "co vim folding"], + 'd' => ["delete fold", "co vim folding"], + 'D' => ["delete folds rec$sign{_}urs$sign{_}ive", "co vim folding"], + 'e' => ["cursor at right side", "po"], + 'E' => ["eliminate folds", "co vim folding"], + 'f' => ["create fold", "co argm vim folding"], + 'F' => ["fold lines", "co vim folding"], + 'g' => ["correct spelling", "co vim7", "Good word"], + 'G' => ["add spelling", "co vim7"], + 'h' => ["scroll $sign{right}", "po"], + 'H' => ["scroll $sign{right} half scr$sign{_}een", "po"], + 'i' => ["toggle all folds", "co vim folding"], + 'j' => ["next fold start", "pm vim folding"], + 'k' => ["prev fold end", "pm vim folding"], + 'l' => ["scroll $sign{left}", "po"], + 'L' => ["scroll $sign{left} half scr$sign{_}een", "po"], + '^m'=> ["line at top bol", "po"], + 'm' => ["fold more", "co vim folding"], + 'M' => ["close all folds", "co vim folding"], + 'n' => ["fold none", "co vim folding"], + 'N' => ["fold normal", "co vim folding"], + 'o' => ["open fold", "co vim folding"], + 'O' => ["open folds rec$sign{_}urs$sign{_}ive$sign{_}ly", "co vim folding"], + 'r' => ["reduce folding", "co vim folding"], + 'R' => ["open all folds", "co vim folding"], + 's' => ["cursor at left side", "po"], + 't' => ["line at top", "po"], + 'u' => ["undo spelling", "co arg vim7"], + 'v' => ["unfold cursor line", "co vim folding"], + 'w' => ["add misspell$sign{_}ing", "co vim7", "Wrong word"], + 'W' => ["temp misspell$sign{_}ing", "co vim7"], + 'x' => ["update folds", "co vim folding"], + 'X' => ["reapply folds", "co vim folding"], + 'z' => ["line at center", "po", "Zee Zenter (with an accent)"], +}, # mode z + +'[' => { + desc => "backward search commands ([)", + lead => "[", + + "`" => ["previous lc mark", "pm vim"], + '#' => ["previous open #if$sign{_}/#else", "pm"], + '(' => ["previous open (", "pm"], + '*' => "[/", + '/' => ["start of C comm$sign{_}ent", "pm"], + "'" => "[` ^", # vim + '{' => ["previous open {", "pm"], + '[' => ["section back$sign{_}ward$sign{_}s", "pm"], + '^['=> ["esc", "mo mode"], + ']' => [qq'section back$sign{_}ward$sign{_}s', "pm"], + + 'c' => ["start of change backw$sign{_}ards", "pm"], + 'd' => ["list define", "co"], + 'D' => ["list defines", "co"], + '^d'=> ["first #define", "po"], + 'f' => "gf", # deprecated + 'i' => ["list line", "co"], + 'I' => ["list lines", "co"], + '^i'=> ["first occur$sign{_}renc$sign{_}e", "po"], + 'm' => ["start of funct$sign{_}ion", "pm"], + 'p' => ["P but reindent", "co"], + 'P' => ["[p", "co"], + 's' => ["last mis$sign{_}spell$sign{_}ing", "po vim7"], + 'S' => ["last bad word", "po vim7"], + 'z' => ["start of open fold", "pm vim folding"], +}, # mode [ + +']' => { + desc => "forward search commands (])", + lead => "]", + + "`" => ["next lc mark", "pm vim"], + '#' => ["next open #endif$sign{_}/#else", "pm"], + ')' => ["next open )", "pm"], + '*' => "]/", + "'" => "]` ^", # vim + '/' => ["end of C comm$sign{_}ent", "pm"], + '[' => [qq'section forw$sign{_}ard', "pm"], + '^['=> ["esc", "mo mode"], + ']' => ["section forw$sign{_}ard", "pm"], + '}' => ["next open }", "pm"], + + 'c' => ["start of change forw$sign{_}ards", "pm"], + 'd' => ["list define", "co"], + 'D' => ["list defines", "co"], + '^d'=> ["first #define", "po"], + 'f' => "gf", # deprecated + 'i' => ["list line", "co"], + 'I' => ["list lines", "co"], + '^i'=> ["first occur$sign{_}renc$sign{_}e", "po"], + 'm' => ["end of funct$sign{_}ion", "pm"], + 'p' => ["p but reindent", "co"], + 'P' => "[p", + 's' => ["next mis$sign{_}spell$sign{_}ing", "po vim7"], + 'S' => ["next bad word", "po vim7"], + 'z' => ["end of open fold", "pm vim folding"], +}, # mode ] + +'^w' => { + desc => "window commands (ctrl-w)", + lead => $ascii ? "'w" : "ŵ", + + '<' => ["decrease width", "po"], + '>' => ["increase width", "po"], + '^' => ["split, edit alt file", "co"], + '_' => ["set height", "po"], + '+' => ["increase height", "po"], + '-' => ["decrease height", "po"], + '=' => ["same height", "po"], + '^['=> ["esc", "mo mode"], + ']' => ["split, to tag", "po"], + '}' => ["tag in preview", "po"], + '|' => ["set width", "po"], + + 'b' => ["go to bottom", "po"], + 'c' => [":close", "po"], + '^c'=> ["abort", "mo mode"], + 'd' => ["split, to def$sign{_}inition", "po"], + 'f' => ["split, edit file", "co"], + 'F' => ["^wf, jump to line", "co vim7"], + 'g' => ["extra cmds", "me arg mode^wg"], + 'h' => ["go left", "po"], + 'H' => ["move far left", "po"], + 'i' => ["split, to decl of id$sign{_}ent$sign{_}ifier", "po"], + 'j' => ["go down", "po"], + 'J' => ["move to bottom", "po"], + 'k' => ["go up", "po"], + 'K' => ["move to top", "po"], + 'l' => ["go right", "po"], + 'L' => ["move far right", "po"], + 'n' => ["open new", "co"], + 'o' => [":only current", "po"], + 'p' => ["go to previous", "po"], + 'P' => ["go to preview", "po"], + 'q' => [":quit current", "co"], + 'r' => ["rotate down$sign{_}ward$sign{_}s", "po"], + 'R' => ["rotate up$sign{_}ward$sign{_}s", "po"], + 's' => ["split horiz$sign{_}ont$sign{_}al$sign{_}ly", "po"], + 'S' => "^ws", + 't' => ["go to top", "po"], + 'v' => ["split vertical$sign{_}ly", "po"], + 'w' => ["go to next", "po", "Wrap around"], + 'W' => ["go above$sign{_}/left", "po"], + 'x' => ["ex$sign{_}change", "po"], + 'z' => ["close preview", "po"], +}, # mode ^w + +'^wg' => { + desc => "extended window commands (ctrl-w g)", + lead => $ascii ? "'wg" : "ŵg", + + '^['=> ["esc", "mo mode"], + ']' => ["split, :tselect", "po"], + '}' => [":ptjump to tag", "po"], + '^]'=> ["split, :tjump", "po"], + 'f' => ["edit file in tab", "co vim7"], + 'F' => ["^wgf, to line$sign{_}nr", "co vim7"], +}, # mode ^w g + +v => { + desc => "visual mode", + + '!' => ["external filter", "co"], + ':' => ["cmd on range", "mo modec"], + '<' => ["un$sign{_}indent", "co"], + '=' => ["equalprg filter", "co"], + '>' => ["indent", "co"], + '~' => ["toggle case", "co vim"], + '^['=> ["esc", "mo mode"], + '^]'=> ["jump to tag", "po"], + + 'a' => ["extend area", "me arg"], # XXX mode + 'A' => ["append to block", "mi modei"], # block + 'c' => ["replace area", "mi modei vim"], + 'C' => ["replace lines", "mi modei vim"], + '^c'=> ["abort", "mo mode"], + 'd' => ["delete area", "co vim"], + 'D' => ["delete lines", "co vim"], + 'g' => ["extra cmds", "me arg modevg"], + '^g'=> ["select mode", "mv"], + '^h'=> ["delete area", "co"], # select mode only + 'i' => ["extend area", "me arg"], + 'I' => ["insert to block", "mi modei"], # block + 'J' => ["join lines", "co"], + 'K' => ["keyword$sign{_}prg", "co"], + 'o' => ["to other corner", "pm"], + 'O' => ["to other side", "pm"], + '^o'=> ["visual once", "mv"], # select + 'p' => ["replace w/ paste", "co"], + 'P' => ["replace w/ paste", "co"], + '^q'=> "^q", + 'r' => ["replace chars", "co arg"], + 'R' => "vS", # "might change in future" + '^s'=> "^s", + 's' => "vc", + 'S' => ["replace full lines", "mi modei vim"], + 'u' => ["lower$sign{_}case", "co vim"], + 'U' => ["upper$sign{_}case", "co vim"], + 'v' => ["char$sign{_}wise", "mv"], + 'V' => ["line$sign{_}wise", "mv"], + '^v'=> ["block$sign{_}wise", "mv"], + 'x' => "vd", + 'X' => "vD", + 'y' => ["yank area", "co"], + 'Y' => ["yank lines", "co"], + + map {$_ => $_} qw( + b B ^b ^d e E ^e f F ^f G h H ^i j ^j k l L m M ^m + n N ^n ^p q ^s t T ^u w W ^w ^y z ^z + ` # $ % ^ * ( 0 ) [ { ] } ; / ? + - _ | + ) # a lot like normal mode +}, # mode v + +vg => { + desc => "extended visual commands (v g)", + lead => "g", + + '^['=> ["esc", "mv modev"], + '?' => ["rot13 encode", "co vim"], + 'J' => ["join leave spacing", "co vim"], + 'q' => ["format", "co vim"], + 'v' => ["previous highl$sign{_}ight", "co"], + 'w' => ["format remain cursor", "co vim7"], +}, # mode v g + +#c => { +# desc => "command-line mode", +# +# '^_' => 'i^_', +# '^^' => 'i^^', +## '^\\'=> ["cmd", "me arg"], +# '^a' => ["complete", ""], #todo +# '^b' => ["bol", "po"], +# '^c' => 'i^c', +# '^d' => ["complete", ""], #todo +# '^e' => ["eol", "po"], +# '^h' => 'i^h', +# '^j' => ["execute cmd", "co"], +# '^k' => 'i^k', +# '^l' => ["complete", ""], #todo +# '^n' => ["complete", ""], #todo +# '^p' => ["complete", ""], #todo +# '^r' => 'i^r', # and then some... +# ## ["insert register", "co arg vim"], +# '^q' => '^q', +# '^u' => 'i^u', +# '^v' => 'i^v', +# '^w' => 'i^w', +# '^y' => ["selec$sign{_}tion to clip$sign{_}b$sign{_}oard", "co"], +#}, # mode c + +i => { + desc => "insert mode", + + '^@' => ["last insert", "co"], + '^^' => ["toggle :lmap usag$sign{_}e", "co vim"], + '^[' => ["esc", "mo mode"], + '^]' => ["abbrev$sign{_}iate", "co vim"], + '^_' => ["change lang$sign{_}uage", "co vim"], + '^\\'=> ["switch mode", "mo arg"], + + '^a' => ["insert prev$sign{_}ious", "co vim"], + '^b' => ["former i^_", "co"], + '^c' => ["abort, no abbr", "mo mode"], + '^d' => ["un$sign{_}indent", "co"], + '^e' => ["ins char below", "co vim"], + '^f' => ["cinkeys: re-indent", "co"], + '^g' => ["start column", "pm arg"], #todo + '^h' => ["back$sign{_}space", "co"], + '^i' => ["tab", "co"], + '^j' => ["enter", "co"], + '^k' => ["di$sign{_}graph", "co arg arg vim", "Key code"], + '^l' => ["im leave ins mode", "mo mode vim"], # insertmode only + '^m' => ["enter", "co"], + '^n' => ["find next keyword", "pm vim"], + '^o' => ["execute cmd", "co"], + '^p' => ["find prev keyword", "pm vim"], + '^q' => "^q", # or i^v + '^r' => ["insert register", "co arg vim"], + '^s' => "^s", + '^t' => ["indent", "co"], + '^u' => ["delete line", "co"], + '^v' => ["literal or char$sign{_}cod$sign{_}e", "co", "Verbatim or by Value"], + '^w' => ["delete word back", "co"], + '^x' => ["expand mode", "me arg modei^x vim"], + '^y' => ["ins char above", "co vim"], + '^z' => [":sus$sign{_}pend in im", "ci vim"], # insertmode only +}, # modei + +'i^x' => { + desc => "insert completion commands (i ctrl-x)", + lead => $ascii ? "'x" : "x̂", + + '^[' => ["esc", "mo mode"], + '^]' => ["complet$sign{_}e tags", "co"], + '^d' => ["complet$sign{_}e def$sign{_}ines", "co"], + '^e' => ["window up", "po"], + '^f' => ["complet$sign{_}e file$sign{_}name$sign{_}s", "co"], + '^i' => ["complet$sign{_}e idents", "co"], + '^k' => ["complet$sign{_}e dict", "co"], + '^l' => ["complet$sign{_}e lines", "co"], + '^n' => ["next complet$sign{_}e", "co"], + '^o' => ["omni complet$sign{_}e", "co vim7"], + '^p' => ["previou$sign{_}s compl$sign{_}ete", "co"], + '^s' => ["spell suggest", "co"], + 's' => 'i^x^s', + '^t' => ["complet$sign{_}e thes$sign{_}aur$sign{_}us", "co"], + '^u' => ["complet$sign{_}e$sign{_}func", "co vim7"], + '^v' => ["complet$sign{_}e ex cmd", "co"], + '^y' => ["window down", "po"], +}, # mode i ^x + +# XXX ex mode if you want to go completely wild + diff --git a/vim-keys.inc.pl b/vim-keys.inc.pl new file mode 100644 index 0000000..c3c2907 --- /dev/null +++ b/vim-keys.inc.pl @@ -0,0 +1,94 @@ +use utf8; +my @num = qw(^0 ^0 ^@ ^0 ^0 ^0 ^^ ^0 ^0 ^0 ^0); + +dvorak => [[ + [@num, qw/ ^[ ^] /], + [qw/ ~ ! @ # $ % ^ & * ( ) { } /], + [qw/ ` 1 2 3 4 5 6 7 8 9 0 [ ] /], +], [ + [qw/^0 ^0 ^0 ^p ^y ^f ^g ^c ^r ^l ^? ^0 /], + [qw/ " < > P Y F G C R L ? + /], + [qw( ' , . p y f g c r l / = )], +], [ + [qw/^a ^o ^e ^u ^i ^d ^h ^t ^n ^s ^_ ^\\ /], + [qw/ A O E U I D H T N S _ | /], + [qw/ a o e u i d h t n s - \\ /], +], [ + [qw/^0 ^q ^j ^k ^x ^b ^m ^w ^v ^z /], + [qw/ : Q J K X B M W V Z /], + [qw/ ; q j k x b m w v z /], +]], + +qwerty => [[ + [@num, qw/ ^_ ^0 /], + [qw/ ~ ! @ # $ % ^ & * ( ) _ + /], + [qw/ ` 1 2 3 4 5 6 7 8 9 0 - = /], +], [ + [qw/^q ^w ^e ^r ^t ^y ^u ^i ^o ^p ^[ ^] /], + [qw/ Q W E R T Y U I O P { } /], + [qw/ q w e r t y u i o p [ ] /], +], [ + [qw/^a ^s ^d ^f ^g ^h ^j ^k ^l ^0 ^0 ^\\ /], + [qw/ A S D F G H J K L : " | /], + [qw/ a s d f g h j k l ; ' \\ /], +], [ + [qw(^z ^x ^c ^v ^b ^n ^m ^0 ^0 ^? )], + [qw( Z X C V B N M < > ? )], + [qw( z x c v b n m , . / )], +]], + +qwertz => [[ + [qw/^^ ^0 ^0 ^0 ^0 ^0 ^0 { [ ] } \\ ^0 /], + [qw{ ° ! " § $ % & / ( ) = ? ` }], + [qw/ ^ 1 2 3 4 5 6 7 8 9 0 ß ´ /], +], [ + [qw/ @ ^w ^e ^r ^t ^z ^u ^i ^o ^p ^0 ~ /], + # ^ show altgr-Q instead + [qw/ Q W E R T Z U I O P Ü * /], + [qw/ q w e r t z u i o p ü + /], +], [ + [qw/^a ^s ^d ^f ^g ^h ^j ^k ^l ^0 ^0 ^0 /], + [qw/ A S D F G H J K L Ö Ä ' /], + [qw/ a s d f g h j k l ö ä # /], +], [ + [qw/^y ^x ^c ^v ^b ^n ^m ^0 ^0 ^_ | /], + [qw/ Y X C V B N M ; : _ > /], + [qw/ y x c v b n m , . - < /], +]], + +arensito => [[ + [@num, qw/ ^[ ^] /], + [qw/ ~ ! @ # $ % ^ & * ( ) { } /], + [qw/ ` 1 2 3 4 5 6 7 8 9 0 [ ] /], +], [ + [qw(^q ^l ^0 ^p ^0 ^0 ^f ^u ^d ^k ^? ^0 )], + [qw( Q L " P < > F U D K ? + )], + [qw( q l ' p , . f u d k / = )], +], [ + [qw/^a ^r ^e ^n ^b ^g ^s ^i ^t ^o ^_ ^\\ /], + [qw/ A R E N B G S I T O _ | /], + [qw/ a r e n b g s i t o - \\ /], +], [ + [qw/^z ^w ^0 ^h ^j ^v ^c ^y ^m ^x /], + [qw/ Z W : H J V C Y M X /], + [qw/ z w ; h j v c y m x /], +]], + +abc => [[ + [@num, qw/ ^_ ^0 /], + [qw/ ~ ! @ # $ % ^ & * ( ) _ + /], + [qw/ ` 1 2 3 4 5 6 7 8 9 0 - = /], +], [ + [qw/^a ^b ^c ^d ^e ^f ^g ^h ^i ^j ^[ ^] /], + [qw/ A B C D E F G H I J { } /], + [qw/ a b c d e f g h i j [ ] /], +], [ + [qw/^k ^l ^m ^n ^o ^p ^q ^r ^s ^0 ^0 ^\\ /], + [qw/ K L M N O P Q R S : " | /], + [qw/ k l m n o p q r s ; ' \\ /], +], [ + [qw'^t ^u ^v ^w ^x ^y ^z ^0 ^0 ^? '], + [qw' T U V W X Y Z < > ? '], + [qw' t u v w x y z , . / '], +]], +