This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: remapping Cygwin 'bash' readline functions to PC keys

Lee D. Rothstein wrote:
John, thanks for the <C-V> heads up! Others had
suggested, variations of 'cat < foo' and 'od -c'. (The
former I got to work, the latter remains a mystery.)
Your solution, besides being the most straight-forward,
is also a great tool to have around. Apparently, it's a
feature of Cygwin, or 'bash', since it doesn't work in
a naked 'cmd.exe' window. I'll be sure to add it to my

Unfortunately the key combos I'm trying to map to
are: <^-->> and <^-<-> (control- and the right and left
arrow keys). It turns out that the character string
outputs for both the:

* naked key
* shift - and the naked key
* control- and the naked key

are all the same.

'od -c' remains a mystery to me too - I guess I'll understand how that command works sometime later this century.
But since I too am strongly interested in putting the Ctrl-<Arrow> keys into buisiness (as previos-word, next-word), I tried the Ctrl-V trick. It worked - thanks to John from me too. This is what I got:
plain left: ^[[D
shift-left: ^[[d
ctrl-left: ^[Od (it's a capital "O" contained in there - not the number zero)

So I added these lines to my .inputrc to get the wordwise movement using Ctrl-<arrow>:
"\eOd": backward-word
"\eOc": forward-word

All the way long I have been talking about rxvt, of course.


Actually, I no longer consider these to be KIDs; these
are the character string graphemic outputs of hitting
the key. I'll continue to reserve "KIDs" for when one
represents these [and the key isomorphisms]
with '/e...', 'C-...', etc. "notation".

Apparently (?), the only way to discriminate among these
three alternatives is with Scan Codes. Apparently, all
the -x-ish stuff I've used (Microemacs, Thompson shell
command line editing) that can discriminate among the
three alternatives all use Scan Codes (?).

 - Any way to map to Scan Codes to 'bash' 'readline'
   functions under Cygwin?
   + Or to key "names" like: '<CTRL-left-arrow>',
 - Any interest among Cygwin developers in adding

 >At 2003-02-19 08:02 AM -0800, John Mapole wrote:
 >You can build your own KID table. Once at the cygwin
 >prompt you can type <C-V>, that's control-V, followed
 >by the key.  On my machine, if I type <C-V><INSERT>, I
 >see "^[[2~".  This is the same as "\e[2~".
 >Why these mapping are like this relates to how windows
 >maps them and then how cygwin maps them.  Something I
 >am now very clear on.
 >Hope this helps some.
 >John Mapoles
 >--- "Lee D. Rothstein" <lee at veritech dot com> wrote:
 >> Q1 -- When you remap a 'bash' Edit Mode function in
 >> .inputrc, it looks like this:
 >> "\e[3~":      delete-char # DEL key
 >> The entity in double quotes ("\e[3~"), I'm calling
 >> the "key ID (KID)". In the above '.inputrc' declaration,
 >> the function 'delete-char' being remapped from its
 >> default key assignment to the KID -- "\e[3~" -- the
 >> <DEL> key.
 >> What are the KIDs of the following IBM PC keys
 >> (specified below with facsimiles of the key caps
 >> contained in angle brackets -- '<...>')?
 >> Cursor control key pad
 >> ----------------------
 >> <HOME>
 >> <END>
 >> <left-arrow>
 >> <right-arrow>
 >> <PAGE_UP>
 >> <INSERT>
 >> Numeric pad
 >> -----------
 >> <->
 >> <+>
 >> <ENTER>
 >> </>

I should have included in the above lists, all variations
of the above with the control, alt and shift keys.

 >> In general, I'd like a table that maps the KIDs for all
 >> 104 keys on the keyboard I use. Or, better still, is
 >> there a way to use scan codes?
 >> (Incidentally, what makes finding a table of these
 >> KIDs so difficult is the failure of the documentation
 >> to assign this concept a unique, or even a consistent
 >> word.)
 >> Q2
 >> --
 >> Is there a way to make the <INSERT> key a toggle
 >> between the insert and overwrite modes of 'bash'
 >> edit mode?
 >> I used to have these figured out for 'Microemacs',
 >> but that was half a lifetime ago, for me, & Microemacs
 >> supported scan codes, if I remember correctly.

Lee D. Rothstein -- lee at veritech dot com
VeriTech -- 603-424-2900
7 Merry Meeting Drive
Merrimack, NH 03054-2934

-- Unsubscribe info: Bug reporting: Documentation: FAQ:

-- Unsubscribe info: Bug reporting: Documentation: FAQ:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]