As far as I can tell, there is no way to set a value for "all keys" in .inputrc
. But realistically, that's not really required in your use case; there are only so many keys you can hit by accident.
Personally, I've been using an .inputrc
originally derived from some very old SUSE release, but it has continued to work perfectly, even after copying it over to various other installs and distros. This file has explicit "nothing" mappings for function keys that are not currently used by readline:
#
# Function keys F1 - F12
#
$if term=linux
#
# On console the first five function keys
#
"\e[[A": prefix-meta
"\e[[B": undo
"\e[[C": ""
"\e[[D": kill-line
"\e[[E": ""
$else
#
# The first five standard function keys
#
"\e[11~": prefix-meta
"\e[12~": undo
"\e[13~": ""
"\e[14~": kill-line
"\e[15~": ""
$endif
"\e[17~": ""
"\e[18~": ""
"\e[19~": ""
"\e[20~": ""
"\e[21~": ""
# Note: F11, F12 are identical with Shift_F1 and Shift_F2
"\e[23~": ""
"\e[24~": ""
where \e[17~
corresponds to F6, and so on.
Mapping the unused function keys to ""
should prevent the beep and the tilde, no matter which desktop environment you're using. I think your best bet is to identify the keys you tend to hit accidentally and assign them to ""
in your .inputrc
.
You can disable the terminal bell with set bell-style none
, also in your .inputrc
.
I would prefer to do this with readline itself. – porton – 2015-12-13T18:07:16.133
readline works in gnome-terminal. – harrymc – 2015-12-15T07:53:39.987
But I want it to work in other terminals such as Konsole too – porton – 2015-12-15T18:46:06.900
1The above applies in theory for all gtk-3 apps, and I added the equivalent for gtk-2 apps. There is no guarantee that this will work for all terminal apps. You have to close all terminal windows before these changes may take effect – harrymc – 2015-12-15T20:43:21.137