What I want to do is made C-h not send backwards-delete-char
there is nothing about it in my inputrc files but is shows up in bind -p
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
C-h is bound to
backward-delete-char by default. If you don't like that, bind it to a different command in your
to make it do nothing.
Note that if your terminal sends C-h for the BackSpace key¹, and
C-h is not explicitly bound to an existing command (so not
C-h will execute
¹ More precisely, if your terminal's configuration tell applications that this is so. This is the
erase character in the stty settings. You can display stty settings by running
Binding to the
nop will suppress the key action, but won't help in case you want to free up the key to be a prefix. Suppose you want to dedicate "M-c" as a prefix to a set of related macros, for example, such that the sequence "M-c M-i" is bound to a macro that simply types a long command
controlct sensor instance. Naturally, "M-c M-d" would print something else, and so on.
But there is a default binding
"\ec": capitalize-word", that would stand in your way. If you print the key sequence "M-c M-i" fast enough (specifically, within the time in milliseconds set by the
keyseq-timeout readline variable), you'll get the desired behavior. But if you linger, bash will execute the "M-c" default binding alone, i. e. the
nop command. So in this case, you really need to unbind the key, not rebind it to something that does nothing.
Fortunately, readline supports that quite easily (@user996142 provided the correct syntax and a reference in a comment):
alone on a line by itself. This clears the binding.
Warning time: Do restart bash (e. g.,
exec bash -l), not just reload the
.inputrc file with "C-x C-r". readline may not report the binding after the reload (
bind -l does not show it, and
bind -q capitalize-word happily reports "capitalize-word is not bound to any keys," but still times out it, just as if it were bound to
nop. This is a bug in some versions of either bash or readline.