Subject: Re: RXVT can you paste into it?
From: Brian Dessent <[email-masked]>
To: [email-masked]
Date: Sat, 19 Jul 2003 13:17:38 -0700

"Hannu E K Nevalainen (garbage mail)" wrote:

> Additionally, having this...
> 
>         $ grep -i ins .inputrc
>         #insert-key
>         "\M-[2~": paste-from-clipboard # Insert
> 
> makes the "Insert" key paste *the first line* of the clipboard.
> 
> /Hannu E K Nevalainen, B.Sc. EE - Micro Computer Systems, 59~14'N, 17~12'E
>  ~ <=> degree
> 
> -- basic keystrokes that are nice to have defined in -- .inputrc --
> 
> #---------------
> # Keybindings...
> #
> 
> # DEL key in bash
> "\e[3~": delete-char
> 
> #insert-key
> "\M-[2~": paste-from-clipboard # Insert
> 
> # Home in rxvt
> "\e[7~": beginning-of-line
> # End in rxvt
> "\e[8~": end-of-line
> 

To elaborate on this topic, attached is a portion of a larger .inputrc
that I've been working on.  I could never figure out exactly which
sequence corresponds to which key, and why they differ slightly between
CMD.EXE and rxvt, so I sat down and enumerated them all.  The way I've
implemented it is with an "$if term=cygwin" around the CMD.EXE bindings,
and a seperate section for the rxvt bindings... this should allow
correct functionality of every special key under both programs, assuming
you bind the sequences to what you want them to do.  One interesting
thing is the level of freedom that rxvt offers you as far as a variety
of combinations.  If you want, for example, shift-ctrl-end to do one
thing and ctrl-end to do another, well by gosh you can set that up.  :-)

You'll see that I've listed a number of keystrokes, but commented them
out.  Feel free to add whatever action you want, I left them there so
that they would remain present in the file.  I especially like the
"history-search-(backward|forward)" actions that I have bound to
PageUp/PageDown.  Type the beginning of a history command and then use
pgup/pgdn to scroll through matching history substitutions that match
what you've entered so far.

This does not include any of the function keys... they are all available
as well but I haven't gotten around to adding them.  There are hundreds
of combinations available there, too: F1, ctrl-F1, shift-F1,
ctrl-shift-F1, alt-F1, etc.

Brian

$if term=cygwin

# these are the key bindings that CMD.EXE (stock cygwin prompt) uses

    "\M-[1~": beginning-of-line       Home (also Shift-, Ctrl-, Shift-Ctrl-)
#"\M-\M-[1~": "Alt-Home"
    "\M-[2~": paste-from-clipboard    Insert (also Shift-, Ctrl-, Shift-Ctrl-)
#"\M-\M-[2~": "Alt-Insert"
    "\M-[3~": delete-char             Del (keypad) (also Shift-, Ctrl-, Shift-Ctrl-)
#"\M-\M-[3~": "Alt-kpDel"
    "\M-[4~": end-of-line             End (also Shift-, Ctrl-, Shift-Ctrl-)
#"\M-\M-[4~": "Alt-End"
    "\M-[5~": history-search-backward Page Up (also Shift-, Ctrl-, Shift-Ctrl-)
#"\M-\M-[5~": "Alt-PageUp"
    "\M-[6~": history-search-forward  Page Down (also Shift-, Ctrl-, Shift-Ctrl-)
#"\M-\M-[6~": "Alt-PageDn"

# I don't know why, but \M-[ works (and  \e[ doesn't) for the following

    "\M-[A": previous-history        Up (also Shift-, Ctrl-, Shift-Ctrl-)
#"\M-\M-[A": "Alt-Up"
    "\M-[B": next-history            Down (also Shift-, Ctrl-, Shift-Ctrl-)
#"\M-\M-[B": "Alt-Down"
    "\M-[C": forward-char            Right (also Shift-, Ctrl-, Shift-Ctrl-)
 "\M-\M-[C": forward-word            Alt-Right
    "\M-[D": backward-char           Left (also Shift-, Ctrl-, Shift-Ctrl-)
 "\M-\M-[D": backward-word           Alt-Left

$endif

$if term=rxvt

# these are the bindings that rxvt uses

# Alt- is not supported for these:

 "\e[7~": beginning-of-line          Home
#"\e[7$": "Shift-Home"
#"\e[7^": "Ctrl-Home"
#"\e[7@": "Shift-Ctrl-Home"

 "\e[2~": paste-from-clipboard       Insert
#"\e[2$": "Shift-Ins"               Shift-Insert is paste, no keycode is sent
#"\e[2^": "Ctrl-Ins"
#"\e[2@": "Shift-Ctrl-Ins"

 "\e[3~": delete-char                Del
#"\e[3$": "Shift-Del"
 "\e[3^": kill-word                  Ctrl-Del"
#"\e[3@": "Shift-Ctrl-Del"

 "\e[8~": end-of-line                End
#"\e[8$": "Shift-End"
#"\e[8^": "Ctrl-End"
#"\e[8@": "Shift-Ctrl-End"

 "\e[5~": history-search-backward    PgUp
#"\e[5$": "Shift-PgUp"              Shift-PgUp views scrollbuffer
#"\e[5^": "Ctrl-PgUp"
#"\e[5@": "Shift-Ctrl-PgUp"

 "\e[6~": history-search-forward     PgDn
#"\e[6$": "Shift-PgDn"              Shift-PgDn views scrollbuffer
#"\e[6^": "Ctrl-PgDn"
#"\e[6@": "Shift-Ctrl-PgDn"

# Alt- not supported; Ctrl-Shift same as Shift-; that's "capitol Oh" not "zero" for Ctrl-

 "\M-[A": previous-history           Up
#"\M-[a": "shift-up"
#"\M-Oa": "ctrl-up"

 "\M-[B": next-history               Down
#"\M-[b": "shift-down"
#"\M-Ob": "ctrl-down"

 "\M-[C": forward-char               Right
#"\M-[c": "shift-right"
 "\M-Oc": forward-word               Ctrl-Right

 "\M-[D": backward-char              Left
#"\M-[d": "shift-left"
 "\M-Od": backward-word              Ctrl-Left

$endif

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/