In readline(3) I should be able to map Control-Backspace to the same function as Control-W (unix-kill-rubout). Regardless of what I put in ~/.inputrc I'm unable to get this to be recognized.

\C-\b: unix-kill-rubout

...for instance does not work. Can I map Control-Backspace to the unix-kill-rubout in readline?

link|improve this question

67% accept rate
feedback

5 Answers

Are you looking for unix-word-rubout or kill-word ? I don't think unix-kill-word exists.

link|improve this answer
Hi, .inputrc actually says unix-kill-rubout, I don't know why I kept thinking it was unix-kill-word. Regardless, it still just asks like regular backspace. – Xepoch Jan 14 '10 at 6:48
feedback

I doubt your terminal will send a special code for ctrl-backspace. Backspace is normally ctrl-?, and you can't add another ctrl modifier to a ctrl character.

One alternative might be to have your terminal send a special escape sequence for Ctrl-Backspace, then map that in your readline config.

link|improve this answer
feedback

For the linux terminal, you can do it by modifying the keymap you load on startup. In ubuntu my default it loads /etc/console-setup/cached.kmap.gz. If you find the entry corresponding to Ctrl-Backspace (probably Control-Delete is listed as Backspace already) then you could change that to Control_w. Not sure about terminal emulators, but konsole (the default KDE terminal emulator) has quite nice settings for keybinds. Hope that helps :)

Chris

link|improve this answer
feedback

This works for me (in urxvt, bash):

"\b":backward-kill-word
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.