Copy and paste to ~/.inputrc. Run bind -f .inputrc to make it active during a session. Does almost most all of what you want....

Details man readline. s/C/\\C/g. English names don't work as advertised.

# do not bell on tab-completion set bell-style off set meta-flag on set input-meta on set convert-meta on set output-meta on # Alt + Backspace delete by words # \C-\b does not give you the behaviour you want # as backspace the key is sent as ^h or ^127 ^\177 # ie it already uses Ctrl+something so Ctrl+Ctrl+something is not vali +d "\M-\b": backward-delete-word # Ctrl + K deletes the current line "\C-k": kill-whole-line # Alt + K deletes the current line "\M-k": kill-whole-line # for linux console and RH/Debian xterm # these codes simulate numeric keypad layout # found on some old machines when there were less keys # Home "\e[1~": beginning-of-line # End "\e[4~": end-of-line # Page Up "\e[5~": beginning-of-history # Page Down "\e[6~": end-of-history # this makes DEL key a universal deleter # it deletes under the cursor if there is a char there # at ^ it deletes like a normal delete key # at $ it deletes like a backspace key "\e[3~": forward-backward-delete-char # these control how the arrows work # arrow keys are problematic due to erratic placement # net effect of this is that arrows work as normal # but alt arrow or control arrow moves by word # this is control arrow "\eOC": forward-word "\eOD": backward-word # this is alt arrow "\e\e[C": forward-word "\e\e[D": backward-word # misc miscompatibility hacks! # for rxvt "\e[8~": end-of-line # for non RH/Debian xterm, can't hurt for RH/DEbian xterm "\eOH": beginning-of-line "\eOF": end-of-line # for freebsd console "\e[H": beginning-of-line "\e[F": end-of-line

To find out what your clients keymappings *really* are just run this script:

[root@devel3 root]# cat key #!/usr/bin/perl use Term::ReadKey; my $RAW = $ARGV[0] ? 1 : 0; ReadMode 4 unless $RAW; sleep 1 while (not defined ($key = ReadKey(-1))) printf "Get key '%s' %d \%o\n", $key, ord($key), ord($key); ReadMode 0 unless $RAW; [root@devel3 root]#

It is very handy. Just press the key (combo) and read the result. Called with the raw arg (actually any true value) it will show you the key mappings in ANSI style. You need to do this as lots of special keyboard keys are ASCII 7. Anyway without it it will give you the key and dec and octal names which may or may not help. Note in raw mode when you see a key combo produce:

^[ this must be replaced with: \e in the .inputrc file. So if you run ./key and say press Ctrl+Left_Arro +w you will get this: $ ./key raw ^[OC Anyway now we know Ctrl+Left_Arrow is ^[OC so in your .inputrc you put: "\eOC": forward-word note s/\^[/\\e/g Then do a bind -f .inputrc and it just works.

cheers

tachyon


In reply to Re: (OT): .inputrc mapping PC keyboard to sensible set vi or set emacs functions. by tachyon
in thread (OT): .inputrc mapping PC keyboard to sensible set vi or set emacs functions. by BrowserUk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.