2

I need to bind the code 127 (aka DEL, aka ^?) to delete-char.

If I put DEL: delete-char to ~/.inputrc, it does not work. This is because this code is used by backward-delete-char by default.

So, first I need to free this code from backward-delete-char:

$ bind -u backward-delete-char

But for some reason it is not unset:

$ bind -q backward-delete-char
backward-delete-char can be invoked via "\C-?".

What should be changed in source code of readline library (for local use) to unbind the \C-? from backward-delete-char?

N.B. If I unset for example delete-char, it works flawlessly:

$ bind -u delete-char
$ bind -q delete-char
delete-char is not bound to any keys.
Igor Liferenko
  • 1,499
  • 1
  • 13
  • 28

1 Answers1

1

Running GNU bash, version 4.4.19(1)-release (x86_64-apple-darwin16.6.0) I see the same thing. I am able to unset the one I wanted with this: bind -m emacs-meta -u backward-kill-word

According to the maintainer Chet:

Unless you use the -m' option, the commands act on the current keymap, which is eitheremacs' or (usually) `vi-insert'

I found that his example commands didn't quite work, and only -m emacs-meta worked - but I'm not sure how to discover precisely which keymap applies.

Discovery process: searched the mailing list (Googled and site:http://lists.gnu.org/archive/html/bug-bash/ "bind -u") and picked up: Re: Some readline functions can't be unbound with bind -u

Ben Creasy
  • 3,825
  • 4
  • 40
  • 50
  • 1
    Note: I recently went back and tried this on `beginning-of-line`, but it wasn't working even with a variety of keymaps - so I ended up unbinding the key sequences one by one (e.g., `bind -r '\C-a'`) – Ben Creasy Sep 20 '18 at 05:02