Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

inputrc file cannot be loaded [closed]

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?

like image 570
user1861088 Avatar asked Jan 14 '23 03:01

user1861088


2 Answers

 $ 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

like image 95
Satish Avatar answered Jan 16 '23 22:01

Satish


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.

like image 44
hlovdal Avatar answered Jan 16 '23 22:01

hlovdal