Unix Shell - bash readline binding C-DEL, C-RET

This is Interesting: Free IT Magazines  
Home > Archive > Unix Shell > February 2005 > bash readline binding C-DEL, C-RET





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author bash readline binding C-DEL, C-RET
Philip Ganchev

2005-02-22, 2:52 am

I'm trying to bind "control-backspace" to "backward-kill-word",
"control-delete" to "kill-word", "control-return" to "complete".

RUBOUT and DEL are mentioned in the bash manual, but not described.

If I include
"\C-DEL": backward-kill-word
or
"C-DEL": backward-kill-word
or
"\C-RUBOUT": backward-kill-word
or
"C-RUBOUT": backward-kill-word

in ~/.inputrc, this does not change the effect of pressing
control-backspace or control-delete.

If I include
"\C-RET": complete
then when pressing Return invokes "complete".
Icarus Sparry

2005-02-22, 2:52 am

On Tue, 22 Feb 2005 00:31:34 -0500, Philip Ganchev wrote:

> I'm trying to bind "control-backspace" to "backward-kill-word",
> "control-delete" to "kill-word", "control-return" to "complete".
>
> RUBOUT and DEL are mentioned in the bash manual, but not described.
>
> If I include
> "\C-DEL": backward-kill-word
> or
> "C-DEL": backward-kill-word
> or
> "\C-RUBOUT": backward-kill-word
> or
> "C-RUBOUT": backward-kill-word
>
> in ~/.inputrc, this does not change the effect of pressing
> control-backspace or control-delete.
>
> If I include
> "\C-RET": complete
> then when pressing Return invokes "complete".


RET is already a control character (Control M, although the Unix tty
driver may make it appear to be Control J), so you can't do anything
useful there.

Backspace is already a control character (Control H).

Delete is a funny character. The control characters are in the range 0 to
31 and 127, with delete being the 127. The non control characters are 32
to 126. Normally to convert to the control character you subtract either
64 or 96 (set bits 5 and 6 to 0) to get a value in the range 0 to 31. If
you do this to delete you get 31. You might find that your system will
read control-Delete as character 31, in which case you might try binding
"\C-?" and see if that does what you want.

If you are working via X, then other options are available.

Icarus Sparry

2005-02-24, 5:58 pm

On Tue, 22 Feb 2005 00:31:34 -0500, Philip Ganchev wrote:

> I'm trying to bind "control-backspace" to "backward-kill-word",
> "control-delete" to "kill-word", "control-return" to "complete".
>
> RUBOUT and DEL are mentioned in the bash manual, but not described.
>
> If I include
> "\C-DEL": backward-kill-word
> or
> "C-DEL": backward-kill-word
> or
> "\C-RUBOUT": backward-kill-word
> or
> "C-RUBOUT": backward-kill-word
>
> in ~/.inputrc, this does not change the effect of pressing
> control-backspace or control-delete.
>
> If I include
> "\C-RET": complete
> then when pressing Return invokes "complete".


RET is already a control character (Control M, although the Unix tty
driver may make it appear to be Control J), so you can't do anything
useful there.

Backspace is already a control character (Control H).

Delete is a funny character. The control characters are in the range 0 to
31 and 127, with delete being the 127. The non control characters are 32
to 126. Normally to convert to the control character you subtract either
64 or 96 (set bits 5 and 6 to 0) to get a value in the range 0 to 31. If
you do this to delete you get 31. You might find that your system will
read control-Delete as character 31, in which case you might try binding
"\C-?" and see if that does what you want.

If you are working via X, then other options are available.

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com