Interrpreting modifier codes in /etc/inputrc ??
Rick Stevens
ricks at nerd.com
Thu Aug 6 21:46:41 UTC 2009
William Case wrote:
> On Thu, 2009-08-06 at 15:29 -0500, Mikkel L. Ellertson wrote:
>> William Case wrote:
>
>> I am lazy - for moving back forth is a line, control of the arrow
>> keys moves word instead of character. Control of backspace deletes
>> deletes to the beginning of the word, and control of delete deletes
>> to end of word.
>>
> Mikkel, I would prefer to be lazy too. However, Control+right-arrow
> simply produces ";5C" at the cursor on my command line and Control
> +left-arrow prints ";5D".
Mikkel is correct. CTRL-left-arrow generates <ESC>[1;5C (<ESC> meaning
"escape" or the "\e" from the previous posts), CTRL-right-arrow produces
<ESC>[1;5D. If you're curios, run "showkey -a" from a command prompt
and press those sequences:
[root at prophead ~]# showkey -a
Press any keys - Ctrl-D will terminate this program
(Press CTRL-left-arrow)
^[[1;5D 27 0033 0x1b ("<ESC>" in decimal, octal and hex)
91 0133 0x5b (the "[" in dec, octal, and hex)
49 0061 0x31 (the "1")
59 0073 0x3b (the ";")
53 0065 0x35 (the "5")
68 0104 0x44 (the "D")
(Press CTRL-right-arrow)
^[[1;5C 27 0033 0x1b (escape)
91 0133 0x5b ("[")
49 0061 0x31 ("1")
59 0073 0x3b (";")
53 0065 0x35 ("5")
67 0103 0x43 ("C")
(Press CTRL-D to exit)
As to bash just displaying the ";5C" or whatever, you have to have data
on the command line for it to the sequences to operate on. If you're
just at a prompt and you hit one of those sequences, there's nothing to
act on and you'll probably rewarded with a beep and a display of the
remainder of the key sequence.
Try putting "the quick brown fox" after a command prompt, then use
CTRL-left-arrow and watch the cursor move back by words.
----------------------------------------------------------------------
- Rick Stevens, Systems Engineer ricks at nerd.com -
- AIM/Skype: therps2 ICQ: 22643734 Yahoo: origrps2 -
- -
- The Theory of Rapitivity: E=MC Hammer -
- -- Glenn Marcus (via TopFive.com) -
----------------------------------------------------------------------
More information about the fedora-list
mailing list