Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: key bindings table?
- X-seq: zsh-users 18506
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: key bindings table?
- Date: Sun, 23 Feb 2014 15:40:48 -0800
- In-reply-to: <5308EDFE.2090800@eastlink.ca>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CAHyxEs0RWnm_h1X6C6+VognALdCjZDabBATjUUtSUR58x+nHDw@mail.gmail.com> <140204073937.ZM21329@torch.brasslantern.com> <52F1146D.5020801@eastlink.ca> <140204194650.ZM21787@torch.brasslantern.com> <52F283E8.4050500@eastlink.ca> <CAH+w=7aqdvx52VFv6MCrkUKqt+5tzH665H_X6U1e1SMvNQF1ig@mail.gmail.com> <5308EDFE.2090800@eastlink.ca>
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author