From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28698 invoked by alias); 23 Feb 2014 23:41:12 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 18506 Received: (qmail 12929 invoked from network); 23 Feb 2014 23:40:56 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 From: Bart Schaefer Message-id: <140223154048.ZM7785@torch.brasslantern.com> Date: Sun, 23 Feb 2014 15:40:48 -0800 In-reply-to: <5308EDFE.2090800@eastlink.ca> Comments: In reply to Ray Andrews "key bindings table?" (Feb 22, 10:35am) References: <140204073937.ZM21329@torch.brasslantern.com> <52F1146D.5020801@eastlink.ca> <140204194650.ZM21787@torch.brasslantern.com> <52F283E8.4050500@eastlink.ca> <5308EDFE.2090800@eastlink.ca> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: key bindings table? MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Feb 22, 10:35am, Ray Andrews wrote: } } Do we have a key bindings table that translates all the various ways of } referring to a key press? You can generate one for your terminal/keyboard combo by running the "zkbd" utility. As you noticed, $terminfo (from zsh/terminfo module) sometimes has useful definitions but it's more interested in what the terminal understands for cursor motion than what the keyboard sends for input. There's documentation for zkbd in the manual. (If someone feels like extending zkbd to cover the keypad, jump right in.) } For example, in 'zbindkey' we have this sort of thing: } } [[ "$terminfo[kend]" == "O"* ]] && } bindkey -M emacs "${terminfo[kend]/O/[}" end-of-line I'm not sure which "zbindkey" this refers to. It's not something that is distributed with zsh. } "^E" end-of-line } "^[OF" end-of-line } "^[[F" end-of-line } } ... so I trust that one of those lines refers to the 'End' key. Which one? Two of them do, in this case. Keyboards can be in two states, usually called "normal mode" and "keypad transmit mode" and the End key sends different sequences depending on which mode is in effect. ^E is the usual emacs end-of-line binding, the other two are End key values. } Is there a table? Or some other way of being able to pick a keystroke } and know how to refer to it in " terminfo[] " ... in " } bindkey-in-zbindkey " ... in "bindkey-at-CLI " and/or in whatever other } languages there may happen to be? There are too many interchangable combinations of keyboards and terminals (and operating systems) to create a table that covers them all. The zkbd utility covers the most common ones (plus some from old Sun keyboards that are a lot less common now) but far from everything. The manual for terminfo (not zsh's manual for the zsh/terminfo module) usually includes a table of the most standard names for display actions, which as mentioned covers some key-driven cursor motions, but also covers all sorts of other display actions that have nothing to do with the keyboard. On top of this you have terminal emulators which often have the ability to redefine all of the keys. Graphical interfaces receive "scan codes" based on the keyboard layout, but CLI programs don't see them, they can only use the character sequences that the emulator generates based on the scan code it receives. DOS was simple because it was Microsoft and IBM everywhere, and it all used the raw scan codes. -- Barton E. Schaefer