!loadkeys-compact-emacs.htm
|∞| Doc: loadkeys-compact-emacs.htm
Changed: 2021nov21

loadkeys-compact-emacs
Apple keyboard, model number A1243. 109 keys.
! Either ! or # declare a comment.

! The keyboard symbol for a key is in a comment after the plain
! keycode, for personal reference.  For example, the Esc key
! might be mapped to "a":
!   keycode 1=a ! Escape

! Before applying a keymap, consider creating an alias to a
! command that restores the current keymap (default or custom) by
! typing a single letter.  Then make sure to know where that
! single letter is mapped on the new keymap, and where the Return
! key is mapped, too.
!
! "sudo loadkeys --default" is suppose to restore the default
! keymap, unless "defkeymap.map" is non-existent.  Otherwise,
! save the current keymap to a document for using with loadkeys,
! or plan to reboot to restore.
! See manual for "keymaps", and for "showkey", too.
!
! Assuming this keymap is named "compact.kmap.html", consider
! applying it with:
!   sudo \
!   loadkeys \
!   --clearstrings \
!   --clearcompose \
!   compact.kmap.html > results 2>&1
! That redirects any output and errors to the "results" document.
! A successful load usually has no results, otherwise review the
! output and errors for what happened unexpectedly.

#Compact functional keyboard.
# * Rotate this keyboard model 180 degrees:
#   keypad on leftside, spacebar at top, function keys at bottom.
#
# 26 lowercase, 26 uppercase, 10 digits, 32 punctuation = 94.
# Three rows of four keys for each hand: 12 x 2 = 24 keys.
# Four symbols x 24 keys = 96 possible slots for symbols.
#
# Symbols are distributed from left to right, top to bottom:
# the letters alphabetically, the numbers numerically, and the
# punctuation conveniently.  Two rows and two columns per key.
# * Lowercase letter at top left of key, capital at top right.
# * Number or punctuation on lower half of a key.
# Two modifier keys.
# * One ShiftR is shift "right" for the right half of a key.
# * One ShiftL is shift "lower" for the lower half of a key.
#
# Eight additional keys are based on range of fingers.
# * One key on the inside of middle row: 1 x 2 = 2.
#   One key on the outside of middle row: 1 x 2 = 2.
#   One key for forefinger above top row: 1 x 2 = 2.
#   One key for middle finger above top row: 1 x 2 = 2.
# Eight thumb keys, four per thumb.
# * One row of three keys for thumb: 3 x 2 = 6.
#   * Middle key is primary position, either "lower" or "right".
#   One key above middle key: 1 x 2 = 2.

# One thumb key for the "lower" modifier, and one thumb key for
# the "right" modifier.  One thumb key for Space, and one thumb
# key for Return.  One of the other eight keys is Delete.  That
# leaves a possibility of four thumb keys and seven other keys,
# when needed, for evoking commands or prefixes within emacs.
#
# * "undo" key: `undo', "C-_".
#
# * "delete" key: DEL.  "right" + "delete": forward delete.
#
# * "ado" key: `universal-argument', "C-u".
#
# * "do/lisp" key: prompt for commands by name.
#   Default is "do".
#   * "do": `execute-extended-command'. (M-x)
#   * "right" + "do": `shell-command'. (M-!)
#   "lower" + "do" is "lisp".
#   * "lisp": `eval-expression'. (M-:)
#   * "right" + "lisp": `eval-last-sexp'. (C-x C-e)
#  ++What about combined with "store" for beginning a macro?
#   But then, how to end a macro?  And, end within a macro?
#
# * "char" key: any character, by means of UTF-8: "C-x 8" prefix.
#
# * "find" key: find next (C-s).
#   * Type "find" key for a prompt for forward search. (C-s)
#   * "lower" + "find" for regexp search. (ESC C-s)
#   * "right" + "find" for query/replace. (ESC %)
#   * "lower" + "right" + "find" for `query-replace-regexp'.
#   After typed it has own emacs keymap `isearch-mode-map'.
#   Likely repurpose keybindings with `define-key'.
#  ++The "prior/next" key could traverse search history.
#   OTOH, "prior" is more likely with history, and "next" is more
#   likely with search.  Maybe separate keys.
#  ++The "list" key could list the whole search history, perhaps
#   enumerated with letters for choosing.  The keys would be
#   keymapped within emacs for the search (mode?), though still
#   need some sort of symbol in the system keymap.
#
# * "apply/store" key: storage across emacs sessions.
#   default: apply from a symbol what was stored. (C-x r i)
#   * "point" + "apply": `jump-to-register' for points. (C-x r j)
#   "lower" + "apply" = "store": store text. (C-x r s)
#   * "point" + "store": `point-to-register'. (C-x r SPC)
#  ++Considering a "prior/next" key, or two keys.  They would
#   traverse prior text for a chosen symbol after it was
#   selected.  The message (non-recorded) "Prior/Next: 4/5 for a"
#   reveals the fourth of five texts for the symbol "a" has been
#   inserted, with "5/5" the most recent addition.  Perhaps
#   "cancel" would revert to without any text inserted, obviating
#   the need for undo afterwards in that case.
#  ++Considering a "list" key.  For this, it would list all
#   symbols with associated text.  Or after a symbol has been
#   chosen typing the "list" key would list all the prior text
#   for that symbol, if any.  Perhaps "cancel" would revert to
#   without any text inserted, obviating the need for undo
#   afterwards in that case.
#  ++Would like to let "apply/store" handle temp storage, once
#   it uses a foldy (for history) for each associated symbol.
#   Maybe for temp storage type "store" a second time for storing
#   it there, and type "apply" twice to apply it from that key.
#
# * "help" key: keybinding prefix "F1" or "C-h" or Help.
#  ++Eventually add to help these descriptions for the keys.
#
# * "macro" key: Macros...
#
# * "mark" key: marking a text region.
#   * "mark": set mark (C-SPC, or C-@).
#   * "point" + "mark": `exchange-point-and-mark'. (C-x C-x)
#   * "right" + "mark": `rectangle-mark-mode'. (C-x SPC)
#
# * Considering a "guess/list" key...
#
# * "point" key: CtrlR (key name for right Control key)
#   * default: position point.
#   * "lower": transpose, case, highlight.
#   * "point" + "mark": `exchange-point-and-mark'. (C-x C-x)
#   With "apply/store" key.
#   * "point" + "apply": `jump-to-register'.
#    ++Transitional: "lower" + "apply" is store point.
#    ++Thinking "apply/store" should already know it is a point.
#  ++"lower" + x: extended keymap, if needed.
#
# * "view" key: `nu-view-select', "F14".
#   * default: split view, new frame, collapse a view or frame.
#   * "right": view document copies, directory listings, etc.
#   *++Swap contents of views. (nu-view-swap-states)
#   *++Consider `clone-indirect-buffer'.
#   *++Consider `xref-find-definitions' (M-.) and "M-,".
#      Though, that is for lisp (or other instructions).
#
# Two keys in middle, between the thumb keys for either thumb.
# * "custom" key: prefix or modifier for personal keybindings.
# * "cancel" key: "C-g".  Usually above the "custom" key.
#   "right": "C-q" for quitting other programs.
#   "lower": exit recursive edit (C-M-c).
#   "lower" + "right": abort recursive edit (C-]).


#++Also need to address the minibuffer and its entry history.
# So far, these are also used in `shell' mode.  They replace
# the command line entry, which for the minibuffer is all its
# content (other than the prompt).
# * Prior entry (M-p), next entry (M-n).
#   Like using "M-y" (w/"M--" for next), after "C-y".
# * Search prior entries (M-r).
#   * Can be one of the options for the "find" key layer.

#++Types of history, t.i. automatic memorization.
# * minibuffer prompt
#   * ESC x
#   * search ("find" key)
# * `shell' mode prompt
# * `yank' (C-y), stored text (prior text auto-stored in list)
# * potentially "store" key, a foldy for each associated symbol.

#++Perhaps a "prior/next" key.  Though, separate "prior" and
# "next" keys could also replace the traditional "next/prior"
# use of the "tab" key and shift-tab (but then there is still
# "tab-completion").
#++Also thinking "fold" (next) and "unfold" (prior), considering
# the lists might become foldies.
#++Also thinking of "past" (prior) and "recent" (next).  More
# specific to history, less likely to be interpreted for view
# management (which is already handled by "view" options).

#++A completion key for tab-completion.  Some way for listing the
# possibilities for completion.  A "list" key makes sense for
# listing, less so for the action of completion itself.
# Maybe a "twim" key for "type what I mean", a variation of
# "do what I mean".
# * "list"
# * "twim": type what I mean.
# * "twit": type what I typed.
# * "twite": type what I typed earlier.
# * "wite": what I typed earlier.
# * "wit": what I typed.
# * "twiwt": type what I want typed.
# * "wiw": what I want.
# * "fitb": fill in the blank.
# * "guess": really an educated guess; probably better than twit.
#   Probably above "help" key.  "list" key for other purposes.
#   Maybe a "guess/list" key.

#++Thinking of renaming some keys.
# * record/stop: macro.
# * custom: apt; idiosyncracies; circumstantial.


#Transitional
# * Arrow keys are still functional, but swapped 180 degrees.
# * Has a Control key and ESC for rarely used emacs keybindings,
#   or those commonly copied by other programs.
#   However, "point" key also works with other programs, because
#   it remaps those same keybindings.  Strings in the system
#   keymap are used for key sequences.

#Layout amongst hardware keys
# * Transitional arrow keys, for other programs.
#
#         arrows
#   ==================
#   Right  Down  Left
#   ------------------
#   Left    Up   Right
#
#           Up
#          ----
#          Down

# * Symbols and some function keys.
#   Transitional: ESC (rare commands), C-z (`suspend-frame').
#   * "lower" + "right" + "+" key = ESC.
#   * "lower" + "right" + "a" key = "C-z".
#
#           keypad                    typewriter
#         ===========          =========================
#             2    1                  v   c
#            ---- ---                --- ----
#            undo DEL                ado  do
#                                        lisp
#
#         +  6  5  4                  f  d  s  a   caps
#         -----------                 -----------  -----
#         aA bB cC dD                 eE fF gG hH  guess
#          1 $2 #3 "4                 '5 @6 %7  8  list
#                      page
#   F19   -  9  8  7   down      t    r  e  w  q   tab
#   ----  -----------  ----    -----  -----------  ----
#   char  iI jJ kK lL  find    apply  mM nN oO pP  help
#         <9 {0 [/ (*          store  )+ ]- }^ >=
#         <9 {0 [- (+          store  )* ]/ }^ >=
#
#         *  /  = clear               4  3  2  1
#         -------------               -----------
#         qQ rR sS tT                 uU vV wW xX
#         yY zZ &\ ,;                 .: |_ ?! `~
#         yY zZ &_ ,;                 .: |\ ?! `~

# * Thumb keys.
#   * Transitional: `save-buffers-kill-terminal' (C-x C-c),
#     as well as the general mode prefix (C-c).
#     "lower" + "right": "F16" key = "C-x"; "{F4}" key = "C-c".
#
#             page
#              up                         6      5
#             ----                      ------ -----
#             mark                      cancel macro
#
#     F16     F15    F14      F13       {F6}     {F5}    {F4}
#   ------- -------- ----    ------    ------- -------- -------
#   RET      lower   view    custom     point   right   SPC TAB
#   FF  C-x (ShiftL)                   (CtrlR) (ShiftR)     C-c


#The "point" key, part 1/2.
# Emacs commands for point movement are positional in the layout.
# Hold "point" key and type one of a-x or RET.
#
# a   b  c  d     e  f  g   h
# --  --------    --------  --
# ct  Ct lu ll    lr pu Vu  vt
#
# i   j  k  l     m  n  o   p
# --  --------    --------  --
# cc  sl wl cl    cr wr sr  vc
#
# q   r  s  t     u  v  w   x
# --  --------    --------  --
# cb  Cb ld bl    br pd Vd  vb
#
#          RET
#          ---
#           nl
#
# Hold the "point" key, then type one of a-x or RET.
# * j-o: least to greatest, leftward/rightward from middle (l,m).
#   d,t: left ends.
#   e,u: right ends.
#   b,c,f,g: upward commands.
#   r,s,v,w: downward commands.
#   top-center-bottom combinations are on the sides.
#
# * Leftward  (j,k,l): sl sentence, wl word, cl character.
#   Rightward (m,n,o): cr character, wr word, sr sentence.
#   Line        (c,s): lu upward, ld downward.
#   Line ending (d,e): ll left-end, lr right-end.
#   Quote/brace (t,u): bl left-end, br right-end.
#   * The emacs commands `backward-sexp' and `forward-sexp'.
#     Replace with a new command:
#     * No pairing needed.  Just find ",',(,[,{,< leftwards,
#       and ",',),],},> rightwards.
#     * Maybe leave out the quotes, just bracings.
#
# * Content   (b,r): Ct top, Cb bottom.
#  [Page/^L   (2,z): Pu upward, Pd downward.]
#   Paragraph (f,v): pu upward, pd downward.
#   Viewful   (g,w): Vu upward, Vd downward.
#
# * Cursor        (a,i,q): ct top, cc center, cb bottom.
#   * emacs command `move-to-window-line-top-bottom'
#   Cursor w/view (h,p,x): vt top, vc center, vb bottom.
#   * emacs command `recenter-top-bottom'
#
# * RET: nl newline after point. (C-o)
#++This part might become "edit" key, with transpose and case.
# Page up, page down, and highlighting would likely stay with
# "point".  Also, bring over narrowing from "view".
##
# The "point" key, part 2/2.
# Transposing, casing, or highlighting with "point" + "lower".
# Hold "point" + "lower" and then type one of a-x.
#
# a   b    c   d   e    f   g   h
# --  --  ---  --  --  ---  ------
# cu  Pu  tlu  hu      tpu  hf  hr
#
# i    j   k   l    m   n   o   p
# --  -----------  -----------  --
# cc  tsl twl tcl  tcr twr tsr  hp
#
# q   r    s   t    u   v   w   x
# --  --  -------  -------  --  --
# cd  Pd  tld tbl  tbr tpd  hw  ek
#
# Hold "point" + "lower" and type one of a-x.
# * Page/^L  (b,r): Pu upward, Pd downward.
# * Transpose.
#   j,k,l: tsl sentence left, twl word left, tcl char left.
#   m,n,o: tcr char right, twr word right, tsr sentence right.
#   t,u: tbl braced pair left, tbr braced pair right.
#   c,s: tlu line up, tld line down.
#   f,v: tpu paragraph up, tpd paragraph down.
#
# * Case of word (ESC u, ESC c, ESC l):
#   a,i,q: cu upcase, cc capitalize, cd downcase.
#
# * "point" + "find": list lines. (ESC s o)
#   * Immediate with marked region.
#   "ado" + "point" + "find": format matches. (C-u ESC s o)
#   * include number (prefix) of prior and next lines.
#   * include number (negative prefix) of only prior lines.
#
# * Highlight.
#   h,p: hr regexp (ESC s h r), hp phrase (ESC s h p)
#   d: hu remove a highlight pattern (ESC s h u)
#   * Remove all highlight patterns by prefixing with "C-u"
#   w: hw write patterns to doc (ESC s h w)
#   g: hf load patterns from doc (ESC s h f)
#
# * x: ek extend keymap ("point" + "lower" + x).

# Probably will extend layout with "point" + "lower" + x, as a
# prefix.  In that way, no modifier needed for a-x again, which
# helps considering "right" is unusable with "point" next to it.
# That will probably require a keymap in emacs, probably with a
# function key in the system keymap as the prefix.  Probably one
# of F5-F12, f.e. "ctrlr shiftl keycode 2=F5" (using the standard
# string for F5).
#
# * Cursor position.
#   cp point/column (C-x =), cl page/line (ESC x what-page)
#   gc goto char (M-g c), gl goto line (M-g l).
#
# * Rectangles.
#   ++Research adding a keymap when rectangle-mark-mode active.
#   Begin marking rectangle. (C-x SPC)
#   * Maybe "right" + "mark".
#   Delete text in rectangle. (C-x r d)
#   * Maybe just DEL.  Might need to detect region is rectangle.
#     Or, maybe add a keymap to rectangle-mark-mode.
#   Replace (clear) text with spaces in rectangle. (C-x r c)
#   Replace content of rectangle with text. (C-x r t)
#   Open rectangle area with spaces. (C-x r o)
#
# * Store rectangle text. (C-x r ESC w)
#   Store rectangle text and delete it. (C-x r k)
#   Insert stored rectangle text at point. (C-x r y)


#++Options sort of about content rather than point or views.
#
# Transferring content.  Either from a point or to a point.
# * Append text region to a doc copy. `append-to-buffer'
# * Prepend text region to a doc copy. `prepend-to-buffer'
# * Insert file. `insert-file' (C-x i)
#   Or, literally, f.e. JPG into a PDF. `insert-file-literally'
# * Write text region to file. `write-region'
# * Append text region to file. `append-to-file'
#
# Text encoding.  See "C-x RET C-h" for a list of commands.
# Some global.
# * C-\            toggle-input-method
# * C-x RET C-\    set-input-method
# Specific to current view.
# * C-x RET f      set-buffer-file-coding-system
# * C-x RET r      revert-buffer-with-coding-system


#++Find, highlight, replace, list.
#
#++Re-assess.
# Point is inactive in prompt, therefore the "point" commands
# can be repurposed by means of the emacs keymap for search.
# Need to assess relevancy for each search command.
#
#++Need to address the possibility of searching history while
# using search.  For example, "ESC r" searches through previous
# search entries.  That is essentially a minibuffer feature.
#
# Type the "find" key for a prompt for a forward search.
# * "lower" + "find" for regexp search. (ESC C-s)
# Then use the "point" key for its own emacs keymap, which
# repurposes a-x.
#
# a  b  c  d   e  f  g  h
# -- -- -- --  -- -- -- --
#          mf  fp       at
#
# i  j  k  l   m  n  o  p
# -- -- -- --  -- -- -- --
#              ac aw al ct
#
# q  r  s  t   u  v  w  x
# -- -- -- --  -- -- -- --
#          ml  fn       wt
#
# * e: fp  find prior. (C-s)
#   u: fn  find next. (C-r)
# * d: mf  first match. (ESC s ESC <)
#   t: ml  last match. (ESC s ESC >)
# * Add from content.
#   m,n,o: ac  char (M-C-y), aw  word (C-w), al  line (M-s C-e).
# * h: at  toggle equality of accented characters. (ESC s ')
#   p: ct  toggle equality of lowercase and uppercase. (ESC s c)
#   x: wt  toggle exact whitespace matching. (ESC s SPC)
#
#   "lower" + "find": toggle regular expression. (ESC s r)
#
#   ??: tp  prior search text (M-p), tn  next search text (M-n).
#   ++ Those two are actually minibuffer history commands.
#
#++Considering an "edit" key.  In that case, it would be
# repurposed by means of the relevant emacs keymap.
# * k: te edit text with temp non-incremental search. (ESC s e)
#   l: dc  remove last char rather than whole addition. (M-C-d)
#   * Remove last addition is just DEL.
#
# * "point" + "find": list lines. (ESC s o)
#   "ado" + "point" + "find": format matches. (C-u ESC s o)
#   * include number (prefix) of prior and next lines.
#   * include number (negative prefix) of only prior lines.
#
# * : hm  highlight match. (ESC s h r)
#   * Same as "point" + h, which is highlight regex.
#    ++But considering rearranging "point" commands...

# Query/replace.
# No need for "find" key.  For `query-replace-map' keymap.
# See "nu_keys.el".
#
#         DEL
#         ---
#          rd
#
# a  b  c  d   e  f  g  h
# -- -- -- --  -- -- -- --
#          re
#
# i  j  k  l   m  n  o  p
# -- -- -- --  -- -- -- --
# ua uo mp sr  sn er so sa
#
# q  r  s  t   u  v  w  x
# -- -- -- --  -- -- -- --
#          ds           ad
#
#         RET  SPC TAB
#         ---  -------
#          ex   nm  nd
#
# (Original keybindings in parentheses.  Some clash.)
# Substitute.
#  m: sn  replace and move to next match. (SPC or y) {act}
#  n: er  edit the replacement text. (E) {edit-replacement}
#  o: so  replace one match and exit. (.) {act-and-exit}
#  p: sa  replace all remainder for current doc. (!) {automatic}
#  x: ad  replace remainder in all docs. (Y) {automatic-all}
# Reconsider.
#  l: sr  replace and remain. (,) {act-and-show}
#  k: mp  move back to prior match. (^) {backup}
#  j: uo  move back and undo prior replacement. (u) {undo}
#  i: ua  move back and undo all replacements. (U) {undo-all}
#  t: ds  redraw screen. (C-l) {recenter}
# Denial.
#  SPC: nm  skip to next match. (DEL or n) {skip}
#  TAB: nd  skip to next file. (N) {exit-current}
#  RET: ex  exit without further replacements. (RET) {exit}
#  CANCEL: quit. (C-g) {quit}
# Recursive edit.
#  d  : re  pause replacement, t.i. recursive edit. (C-r) {edit}
#  DEL: rd  delete match and pause. (C-w) {delete-and-edit}
#  End recursive edit same as usual: LOWER + CANCEL. (M-C-c)


#
#++Reconsidering...(maybe not...Considering new "edit" instead.)
# Perhaps make "view" a modifer key, CtrlL (left Control key).
# Part 3 would be primary.  Part 1 is just the `nu-view-select'
# command, so either fit it in the primary layout, or the
# secondary layout ("view" + "right").
##
# View management, part 1/3: view select.
# Keys: Type "view", then type one of a-v. (no modifiers)
#       Type "view", then type one of A-X (t.i. "right" + a-x).
#
# The "view" key evokes a command that waits for another key.
# Type the "view" key without holding it, then type a letter.
#
# View ids are lowercase letters and frame ids are uppercase.
# * "view", then letter: focus on the view of that id (a-v).
# * "view", then "right" + letter: show frame of that id (A-X).
# Collapse the current view or frame.
# * "view", then DEL: collapse the current view.
# * "view", then "right" + DEL: collapse the current frame.
#   Collapsing a frame collapses all of its views, too.
#
#++Need access to minibuffer, too.
# w: keymap extended for micromanaging view width and height.
# x: keymap extended for split view, collapse, and doc access.

# View management, part 2/3: micromanage view width and height.
# Keys: type "view", then type w, then type one of a-x.
#
# a  b  c  d   e  f  g  h
# ----- -- --  -----------
#       hi
#
# i  j  k  l   m  n  o  p
# ----- -----  -----------
#       hm wd  wi
#
# q  r  s  t   u  v  w  x
# ----- -- --  -----------
#       hd
#
# * Resize a view.
#   l,m: wd decrease width, wi increase width. (C-x {, C-x })
#   c,s: hi increase height, hd decrease height. (C-x ^)
#   k: hm minimize height (when taller than content). (C-x -)
#
#++Consider some other obscure options.
# * Clone the doc of a view. `clone-indirect-buffer'
# * Shell (ESC x shell).  Or somehow as an item in ibuffer.
# * Rmail (ESC x rmail).  Or somehow as an item in ibuffer.

# View management, part 3/3: split, collapse, and doc access.
# Keys: type "view", then type x, then type one of a-x or DEL.
#       type "view", then type x, then type "right" + DEL.
#
#            DEL
#            ------
#             vo fo
#
# a   b   c   d     e   f   g   h
# --  --  --  --+--+--  --  --  --
# dl  dc  st  pv    pc  fp  np  cl
# |       |             |   |   |
# i   j   k   l     m   n   o   p
# --++--  ------+--+--  --  --  --
# dv  dr  bv  sl    sr  fm  nr  cv
# |       |             |   |   |
# q   r   s   t     u   v   w   x
# --  --  --  --+--+--  --  --  --
# ds  rt  sb  cp    ca  fn  nw  cs
#
# * Split current view horizontally or vertically, then focus.
#   l,m: sl horizontal then left, sr horizontal then right.
#   c,s: st vertical then top, sb vertical then bottom.
#   k: bv balance views (equalize widths and heights)
#   DEL: vo = collapse all other views in current frame.
# * A new frame begins with the current view.
#   f,n,v: fp prior, fm make, fn next.
#   "right" + DEL: fo = collapse all other frames.
# * Listing stored documents and viewing a copy of them.
#   a: dl view listing of stored docs (C-x d).
#   i: dv view copy of stored doc by name (C-x C-f).
#   q: ds replace stored doc with doc copy (C-x C-s).
#
#   b: dc directory listing with doc copy source. (C-x C-j)
#   j: dr view copy of stored doc by name as read-only. (C-x C-r)
#   r: rt toggle read-only view. (C-x C-q)
#
#   h: cl view listing of all doc copies. (ESC x ibuffer)
#   p: cv view a doc copy by name. (C-x b)
#   x: cs store a doc copy to another name. (C-x C-w)
# * Put away document copy.
#   d: pv put away doc copy and collapse view. (C-x 4 0)
#   e: pc put away doc copy. (C-x k)
# * Copy region from current view.
#   t: cp prepend to doc copy by name. (ESC x prepend-to-buffer)
#   u: ca append to doc copy by name. (ESC x append-to-buffer)
# * Narrow content vertically.
#   g,o: np page (C-x n p), nr region (C-x n n).
#   w: nw widen (C-x n w).


#View "*Messages*" document (C-h e).  Probably "help" key.
# View personal init document.  (Custom: ESC F1)


#
! Within the console, the Control modifier is effective with only
! the ASCII values 0-31, known by the values: @ A-Z [ \ ] ^ _.
! ASCII 0, or Control-@, is "nul".  Control-A is "Control_a", and
! so on.  Each punctuation is named.  "VoidSymbol" is none.
! Contrarily, the Meta modifier modifies the ASCII values 0-127.
! Together, there is "Meta_nul", "Meta_Control_a", and so on.
! "dumpkeys -l" lists the known symkeys.

! There are typically 256 possible combinations of 9 modifier
! keys, in addition to the unmodified key (plain).  Therefore,
! 257 total, and all on the same line.
! Setting only the unmodified key (column 0) will automatically
! set all modified combinations to that value, too, which is a
! requirement for assigning a modifier.  For example:
!    keycode 29=Control
! is the same as repeating the name "Control" 256 more times for
! the other 256 columns on the line.
!
! The first value (column 0) is the unmodified key, the second
! value (column 1) is the key modified by shift, and so on.
!   plain 0
!   shift 1  altgr 2  control 4  alt 8
!   shiftl 16  shiftr 32
!   ctrll 64  ctrlr 128
!   capsshift 256
!
! Alternatively, each combination for a keycode can be set
! individually by listing the modifier names prior the keycode,
! one combination per line.


! A plus sign + before the value means the shifted value will be
! returned when caps lock is active.
! For example, it is common to need to type a variable named
! with multiple words separated by underscores while using all
! uppercase letters.  That works with shift lock, which allows
! typing all the shifted values.  Caps lock traditionally allows
! typing the shifted values of only a to z, then requires using
! shift for other keys as needed.  An alternative is to allow
! typing an underscore with capslock without having to use the
! shift key for underscore (from the minus key).  Presuming the
! keycode is 12 for the key:
!   keycode 12=+minus underscore
! Additionally, a plus sign before the shifted value means the
! plain value will be returned when using both caps lock and
! shift:
!   keycode 16=q +Q
! Oddly, it seems a-z need the plus sign for caps lock, too, so:
!   keycode 16=+q +Q


! Text can be defined for any key, rather than just a single
! character.  Custom texts are usually associated with the
! keys F30-F246 (typically unavailable on keyboards).  For
! example: commands for the command interpreter or for emacs;
! a common phrase or statement; a console code.  After defining
! text for a symkey, associate the same symkey with a keycode
! for the keyboard.  Type the key once to produce the whole text
! for whatever program currently has focus.
!
!   string F30="\030r" ! emacs prefix: Control x (octal) and r
!   keycode 58=F30 ! 58 is the caps lock key
!
!   string F31="\160\141\163\163\167\157\162\144" ! password
!   keycode 183=F31 ! 183 is the F13 key
!
!   string F32="\012\074p>" ! newline and HTML paragraph mark
!   shift keycode 28=F32 ! Return key with shift key
!
! Actual control characters are also okay, such as typed with the
! quoted-insert command (C-q) in emacs.


#
! Optionally, declare which columns are being defined.
! Multiple values and ranges are allowed, comma separated.

!keymaps 0,1,4,5,8,9,12,13 ! Only: plain, shift, control, alt.
keymaps 0-127 ! Default keymap defines 0-127.  Override all.


! Keypad
! The keyboard is rotated 180 degrees with the keypad on the
! leftside.


! Top row: Enter, period, zero
! Transitional Control key for the large Enter key.
keycode 96=VoidSymbol ! KP_Enter
keycode 83=VoidSymbol ! KP_Period
keycode 82=VoidSymbol ! KP_0


! Second row: 3-1

keycode 81=VoidSymbol ! KP_3

! Undo in emacs is "C-_".
plain keycode 80=Control_underscore ! KP_2

! DEL (127) is Delete.
! Forward delete in emacs is "C-d", a.k.a. Remove.
plain keycode 79=Delete ! KP_1
shiftr keycode 79=Remove ! forward delete

! Third row: plus, 6-4

plain keycode 78=a ! KP_Add
shiftr keycode 78=A
shiftl keycode 78=Escape ! transitional emacs
shiftl shiftr keycode 78=one
! "point": `move-to-window-line-top-bottom'.  Cursor to top.
string F26="\0250\033r" ! C-u 0 ESC r
ctrlr keycode 78=F26
! Transitional for possible emacs commands.
control keycode 78=Control_a

plain keycode 77=b ! KP_6
shiftr keycode 77=B
shiftl keycode 77=dollar
shiftl shiftr keycode 77=two
! "point": `beginning-of-buffer'.
ctrlr keycode 77=Meta_less
! "point": `backward-page'.  Prior page (^L char for new page).
string F24="\030[" ! C-x [
ctrlr shiftl keycode 77=F24
! Transitional for possible emacs commands.
control keycode 77=Control_b

plain keycode 76=c ! KP_5
shiftr keycode 76=C
shiftl keycode 76=numbersign
shiftl shiftr keycode 76=three
! "point": `previous-line'.
ctrlr keycode 76=Control_p
! Transitional for possible emacs commands.
control keycode 76=Control_c

plain keycode 75=d ! KP_4
shiftr keycode 75=D
shiftl keycode 75=quotedbl
shiftl shiftr keycode 75=four
! "point": `move-beginning-of-line'.
ctrlr keycode 75=Control_a
! Transitional for possible emacs commands.
control keycode 75=Control_d


! Fourth row: minus, 9-7

plain keycode 74=i ! KP_Subtract
shiftr keycode 74=I
shiftl keycode 74=less
shiftl shiftr keycode 74=nine
! "point": `move-to-window-line-top-bottom'.  Cursor to center.
ctrlr keycode 74=Meta_r
! Transitional for possible emacs commands.
control keycode 74=Control_i

plain keycode 73=j ! KP_9
shiftr keycode 73=J
shiftl keycode 73=braceleft
shiftl shiftr keycode 73=zero
! "point": `backward-sentence'.  Move to start of sentence ".  ".
ctrlr keycode 73=Meta_a
! Transitional for possible emacs commands.
control keycode 73=Control_j

plain keycode 72=k ! KP_8
shiftr keycode 72=K
shiftl keycode 72=bracketleft
shiftl shiftr keycode 72=minus
! "point": `backward-word'.
ctrlr keycode 72=Meta_b
! Transitional for possible emacs commands.
control keycode 72=Control_k
control shiftl keycode 72=Escape

plain keycode 71=l ! KP_7
shiftr keycode 71=L
shiftl keycode 71=parenleft
shiftl shiftr keycode 71=plus
! "point": `backward-char'.
ctrlr keycode 71=Control_b
! Transitional for possible emacs commands.
control keycode 71=Control_l


! Fifth row: asterisk, slash, equals, Clear

plain keycode 55=q ! KP_Multiply ! asterisk
shiftr keycode 55=Q
shiftl keycode 55=y
shiftl shiftr keycode 55=Y
! "point": `move-to-window-line-top-bottom'.  Cursor to bottom.
string F25="\025-\033r" ! C-u - ESC r
ctrlr keycode 55=F25
! Transitional for possible emacs commands.
control keycode 55=Control_q
control shiftl keycode 55=Control_y

plain keycode 98=r ! KP_Divide ! slash
shiftr keycode 98=R
shiftl keycode 98=z
shiftl shiftr keycode 98=Z
! "point": `end-of-buffer'.
ctrlr keycode 98=Meta_greater
! "point": `forward-page'.  Next page (^L char is a new page).
string F23="\030]" ! C-x ]
ctrlr shiftl keycode 98=F23
! Transitional for possible emacs commands.
control keycode 98=Control_r
control shiftl keycode 98=Control_z

plain keycode 117=s ! equal ! apparently no "KP_Equal"
shiftr keycode 117=S
shiftl keycode 117=ampersand
shiftl shiftr keycode 117=underscore
! "point": `next-line'.
ctrlr keycode 117=Control_n
! Transitional for possible emacs commands.
control keycode 117=Control_s
control shiftl keycode 117=Control_underscore

plain keycode 69=t ! Num_Lock ! Clear key
shiftr keycode 69=T
shiftl keycode 69=comma
shiftl shiftr keycode 69=semicolon
! "point": `backward-sexp'.  Start of brace pair: (), [], etc.
ctrlr keycode 69=Meta_Control_b
! Transitional for possible emacs commands.
control keycode 69=Control_t


! Emacs needs the default strings (of console codes) in order to
! recognize the function keys.  See variable `input-decode-map',
! and the help for emacs bindings (C-h b and search for "M-[").
!string F19="\033[33~"
!string F18="\033[32~"
!string F17="\033[31~"
!string F16="\033[29~"

! The "char" key.  Because no key next to "-", keycode 74.
! Redefine the string for F19.
string F19="\0308" ! "C-x 8" prefix for UTF-8 characters.
plain keycode 189=F19

keycode 188=VoidSymbol ! F18
keycode 187=VoidSymbol ! F17

plain keycode 186=Return ! F16
shiftl keycode 186=Control_l ! form feed
! "point": `open-line'.  Newline after point.
ctrlr keycode 186=Control_o
! Transitional: C-x prefix for emacs.
! Also part of "C-x C-c" for `save-buffers-kill-terminal'.
shiftl shiftr keycode 186=Control_x



! Middle set of keys.
! Emacs needs the default strings (of console codes) in order to
! recognize the Home, PageUp, Remove, End, PageDown keys.
! See variable `input-decode-map', and help for emacs bindings
! (C-h b and search for "M-[").


! Arrow Keys
plain keycode 106=Left ! Right
plain keycode 108=Up ! Down
plain keycode 105=Right ! Left
plain keycode 103=Down ! Up


! First row: PageDown, End, Forward delete (Remove)
!string PageDown="\033[6~"
!string End="\033[4~"
!string Remove="\033[3~"

! The "find" key.  Default is `isearch-forward'.
! After it is typed, it is keymapped as a prefix in emacs.
plain keycode 109=Control_s ! PageDown ! aka:Next

keycode 107=VoidSymbol ! End ! aka: Select
keycode 111=VoidSymbol ! Remove ! forward delete


! Second row: PageUp, Home, Fn
!string PageUp="\033[5~"
!string Home="\033[1~"

! The "mark" key.  C-@, aka: nul.
plain keycode 104=nul ! PageUp ! aka: Prior
string F32="\030\030" ! "C-x C-x": exchange-point-and-mark
ctrlr keycode 104=F32

keycode 102=VoidSymbol ! Home ! aka: Find
keycode 464=VoidSymbol ! Fn key


! Function keys F13-F19.  No need for Fn key.
! Emacs needs the default strings (of console codes) in order to
! recognize the function keys.  See variable `input-decode-map',
! and the help for emacs bindings (C-h b and search for "M-[").
!string F15="\033[28~"
string F14="\033[26~"
!string F13="\033[25~"

! This is the "lower" modifier key.
! Numbers on lower left, and punctuation on left and right.
keycode 185=ShiftL ! F15

! The "view" key.  New command `nu-view-select'.
plain keycode 186=F14

!++The "custom" key.
keycode 183=VoidSymbol ! F13



! Typewriter keys, other symbols, and modifier keys.


! First row: Control keys, Option keys, Command keys, Spacebar.
keycode 97=VoidSymbol ! Control ! right control key
keycode 100=VoidSymbol ! Alt ! right option key
keycode 126=VoidSymbol ! right command key
keycode 57=VoidSymbol ! space ! the spacebar
keycode 125=VoidSymbol ! left command key
keycode 56=VoidSymbol ! Alt ! left option key

! Transitional Control key for emacs or other programs.
keycode 29=Control ! left control key


! Second row: Shift, punctuation, m-z.

keycode 54=VoidSymbol ! Shift ! right shift key
keycode 53=VoidSymbol ! slash question
keycode 52=VoidSymbol ! period greater
keycode 51=VoidSymbol ! comma less
keycode 50=VoidSymbol ! m M
keycode 49=VoidSymbol ! n N
keycode 48=VoidSymbol ! b B

! "ado" key: emacs `universal-argument' (C-u).
plain keycode 47=Control_u ! v V

! The "do" key.
! command line prompt `execute-extended-command' (M-x).
! external command line prompt `shell-command' (M-!).
! lisp prompt `eval-expression' (M-:).
! evaluate lisp form `eval-last-sexp' (C-x C-e).
plain keycode 46=Meta_x ! c C
shiftr keycode 46=Meta_exclam
shiftl keycode 46=Meta_colon
string F31="\030\005" ! C-x C-e
shiftl shiftr keycode 46=F31

keycode 45=VoidSymbol ! x X
keycode 44=VoidSymbol ! z Z
keycode 42=VoidSymbol ! Shift ! left shift key


! Third row:  caps lock, a-l, punctuation, Return key.

keycode 28=VoidSymbol ! Return Linefeed ! Linefeed is C-j in emacs
! The Fn key with the Return key produces keycode 110.
! Keycode 110 is usually Insert.
!keycode 110= ! Fn modifier with Return key

keycode 40=VoidSymbol ! apostrophe quotedbl
keycode 39=VoidSymbol ! semicolon colon
keycode 38=VoidSymbol ! l L
keycode 37=VoidSymbol ! k K
keycode 36=VoidSymbol ! j J
keycode 35=VoidSymbol ! h H
keycode 34=VoidSymbol ! g G

plain keycode 33=e ! f F
shiftr keycode 33=E
shiftl keycode 33=five
shiftl shiftr keycode 33=apostrophe
! "point": `move-end-of-line'.
ctrlr keycode 33=Control_e
! Transitional for possible emacs commands.
control keycode 33=Control_e

plain keycode 32=f ! d D
shiftr keycode 32=F
shiftl keycode 32=six
shiftl shiftr keycode 32=at
! "point": `backward-paragraph'.
ctrlr keycode 32=Meta_braceleft
! Transitional for possible emacs commands.
control keycode 32=Control_f

plain keycode 31=g ! s S
shiftr keycode 31=G
shiftl keycode 31=seven
shiftl shiftr keycode 31=percent
! "point": `scroll-down-command'.  Prior viewful.
ctrlr keycode 31=Meta_v
! Transitional for possible emacs commands.
control keycode 31=Control_g

plain keycode 30=h ! a A
shiftr keycode 30=H
shiftl keycode 30=eight
shiftl shiftr keycode 30=Control_z ! suspend emacs
! "point": `recenter-top-bottom'.  Move content w/cursor to top.
string F22="\0250\014" ! C-u 0 C-l
ctrlr keycode 30=F22
! Transitional for possible emacs commands.
control keycode 30=BackSpace

keycode 58=VoidSymbol ! Caps_Lock ! caps lock


! Fourth row: brackets/braces, p-q, Tab.

keycode 43=VoidSymbol ! backslash bar
keycode 27=VoidSymbol ! bracketright braceright
keycode 26=VoidSymbol ! bracketleft braceleft
keycode 25=VoidSymbol ! p P
keycode 24=VoidSymbol ! o O
keycode 23=VoidSymbol ! i I
keycode 22=VoidSymbol ! u U
keycode 21=VoidSymbol ! y Y

! The "apply/store" key.  Redefine the string for PageDown.
! "apply": insert text
string F27="\030ri" ! "C-x r i": `insert-register'
plain keycode 20=F27 ! t T
! "point" + "apply": jump to point
string F28="\030rj" ! "C-x r j": `jump-to-register'
ctrlr keycode 20=F28
! "store": store text
string F29="\030rs" ! "C-x r s": `copy-to-register'
shiftl keycode 20=F29
! "point" + "store": store point
string F30="\030r " ! "C-x r SPC": `point-to-register'
ctrlr shiftl keycode 20=F30


plain keycode 19=m ! r R
shiftr keycode 19=M
shiftl keycode 19=parenright
shiftl shiftr keycode 19=asterisk
! "point": `forward-char'.
ctrlr keycode 19=Control_f
! Transitional for possible emacs commands.
control keycode 19=Control_m

plain keycode 18=n ! e E
shiftr keycode 18=N
shiftl keycode 18=bracketright
shiftl shiftr keycode 18=slash
! "point": `forward-word'.
ctrlr keycode 18=Meta_f
! Transitional for possible emacs commands.
control keycode 18=Control_n
control shiftl keycode 18=Control_bracketright

plain keycode 17=o ! w W
shiftr keycode 17=O
shiftl keycode 17=braceright
shiftl shiftr keycode 17=asciicircum
! "point": `forward-sentence'.  Move to end of sentence: ".  ".
ctrlr keycode 17=Meta_e
! Transitional for possible emacs commands.
control keycode 17=Control_o
control shiftl shiftr keycode 17=Control_asciicircum

plain keycode 16=p ! q Q
shiftr keycode 16=P
shiftl keycode 16=greater
shiftl shiftr keycode 16=equal
! "point": `recenter-top-bottom'.  Content w/cursor to center.
ctrlr keycode 16=Control_l
! Transitional for possible emacs commands.
control keycode 16=Control_p

! The help in emacs is C-h, the F1 key, or the Help key.
plain keycode 15=Help ! Tab

! Fifth row: Delete, numbers/punctuation, backtick/tilde.

keycode 14=VoidSymbol ! Delete
keycode 13=VoidSymbol ! equal plus
keycode 12=VoidSymbol ! minus underscore
keycode 11=VoidSymbol ! zero parenright
keycode 10=VoidSymbol ! nine parenleft
keycode 9=VoidSymbol ! eight asterisk
keycode 8=VoidSymbol ! seven ampersand

! The "cancel" key.  Cancel by means of "C-g".
plain keycode 7=Control_g ! six asciicircum
! Quit a program, other than emacs.
shiftr keycode 7=Control_q
! Exit recursive edit (C-M-c), or abort it (C-]).
shiftl keycode 7=Meta_Control_c
shiftl shiftr keycode 7=Control_bracketright


!++The "edit" key.  Maybe key for macros instead.
keycode 6=VoidSymbol ! five percent

plain keycode 5=u ! four dollar
shiftr keycode 5=U
shiftl keycode 5=period
shiftl shiftr keycode 5=colon
! "point": `forward-sexp'.  Ending of brace pair: (), [], etc.
ctrlr keycode 5=Meta_Control_f
! Transitional for possible emacs commands.
control keycode 5=Control_u

plain keycode 4=v ! three numbersign
shiftr keycode 4=V
shiftl keycode 4=bar
shiftl shiftr keycode 4=backslash
! "point": `forward-paragraph'.
ctrlr keycode 4=Meta_braceright
! Transitional for possible emacs commands.
control keycode 4=Control_v
control shiftl keycode 3=Control_backslash

plain keycode 3=w ! two at
shiftr keycode 3=W
shiftl keycode 3=question
shiftl shiftr keycode 3=exclam
! "point": `scroll-up-command'.  Next viewful.
ctrlr keycode 3=Control_v
! Transitional for possible emacs commands.
control keycode 3=Control_w

plain keycode 2=x ! one exclam
shiftr keycode 2=X
shiftl keycode 2=grave
shiftl shiftr keycode 2=asciitilde
! "point": `recenter-top-bottom'.  Content w/cursor to bottom.
string F21="\025-\014" ! C-u - C-l
ctrlr keycode 2=F21
! Transitional for possible emacs commands.
control keycode 2=Control_x

keycode 41=VoidSymbol ! grave asciitilde



! Eject, system/function keys F1-F12, Escape


! Eject key.  Probably Eject_CD.
!string F20="\033[34~" ! found string in emacs keybindings
keycode 161=VoidSymbol ! eject


! The system/function keys F1-F12 are primarily system keys for
! brightness, etc., noted in comments but mostly useless.  The
! Fn key is needed for the function keys, themselves defined
! further below.

! Consoles are usually F1-F6 with Alt and sometimes Control.
! Remapped some system keys to the additional consoles instead,
! therefore without needing Alt nor Control, nor even Fn.
! There are 63 consoles available.  Consider using modifier keys
! for adding more consoles beyond the number of available
! unmodified keys.  Or, consider using frames within emacs.
plain keycode 115=Console_6 ! increase volume (F12)
plain keycode 114=Console_5 ! decrease volume (F11)
plain keycode 113=Console_4 ! mute volume (F10)
plain keycode 163=Console_3 ! next track (F9)
plain keycode 164=Console_2 ! play/pause (F8)
plain keycode 165=Console_1 ! prior track (F7)

! "point" key.
! Map keybindings for moving the cursor.
keycode 230=CtrlR ! no system label (F6)

! This is the "shift right" modifier key.
! Capital letters are top right, and punctuation is lower right.
keycode 229=ShiftR ! no system label (F5)

plain keycode 204=space ! widget views (F4)
shiftr keycode 204=Tab
! Transitional: "C-c" is default mode prefix.
! Also part of "C-x C-c" for `save-buffers-kill-terminal'.
shiftl shiftr keycode 204=Control_c
! Transitional for possible emacs commands.
control keycode 204=nul ! emacs: C-@ (C-SPC) set-mark

keycode 120=VoidSymbol ! show all views of all applications (F3)
keycode 225=VoidSymbol ! increase brightness (F2)
keycode 224=VoidSymbol ! decrease brightness (F1)


! Keycodes for F1-F12.  Usually need Fn key, but unmapped all.
! Emacs needs the default strings (of console codes) in order to
! recognize the function keys.  See variable `input-decode-map',
! and the help for emacs bindings (C-h b and search for "M-[").
!string F12="\033[24~"
!string F11="\033[23~"
!string F10="\033[21~"
!string F9="\033[20~"
!string F8="\033[19~"
!string F7="\033[18~"
!string F6="\033[17~"
!string F5="\033[[E"
!string F4="\033[[D"
!string F3="\033[[C"
!string F2="\033[[B"
!string F1="\033[[A"

keycode 88=VoidSymbol ! F12
keycode 87=VoidSymbol ! F11
keycode 68=VoidSymbol ! F10
keycode 67=VoidSymbol ! F9
keycode 66=VoidSymbol ! F8
keycode 65=VoidSymbol ! F7
keycode 64=VoidSymbol ! F6
keycode 63=VoidSymbol ! F5
keycode 62=VoidSymbol ! F4
keycode 61=VoidSymbol ! F3
keycode 60=VoidSymbol ! F2
keycode 59=VoidSymbol ! F1

! Transitional key for emacs.
keycode 1=VoidSymbol ! Escape


!
about.htm