I just figured out we can create a ~/.inputrc
file to define keyboard mappings. But I don't know how to load it. I tried to source it but I get a 'set Syntax Error' immediately. I copied the ~/.inputrc
file from here: http://www.linuxfromscratch.org/lfs/view/6.2/chapter07/inputrc.html
It mentions that it is loaded using Readline. What does that mean?
$ bind -f ~/.inputrc
-f filename
: Read key bindings from filename
.
$ help bind
Notes: It's a built-in bash command, so it will only work with bash
or sh
. It won't work with ksh
or csh
shell, for tcsh or csh shell you need to use bindkey
command. For more help: bindkey
Readline is one of several possible "keyboard input handling frontends" that a program might use. A program might also use none (other than the usual stdio handling done by libc).
As mentioned, .inputrc
is used by readline, so it will only affect programs that use readline. Bash is such a program, so it will use .inputrc
indirectly, but it is not a file that you will source like files as .bashrc
, and the syntax is not related at all.
The .inputrc
file is only loaded (indirectly though the readline library) by the program at startup. From the documentation:
When a program which uses the Readline library starts up, the init file is read, and the key bindings are set.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With