138

Background

I have heard that the readline module is reading ~/.inputrc and that is how it changes the behaviour of keystrokes under programs such as bash.

Question

How can I reload this after editing to see the changed behaviour without restarting my terminal program?

kevinarpe
  • 4,048

6 Answers6

99

By default, C-x C-r is bound to re-read-init-file.

See the Bash Reference Manual for explanation.

maxelost
  • 3,205
97

You can also reload new entries from command line using bind -f ~/.inputrc. That will load the entries in .inputrc. Note that it just does a load, not a "reload" - so it doesn't reset any lines you happen to have removed from the .inputrc.

To quickly test from a clean slate, just run bash then work inside that new nested shell (or start a new terminal).

studgeek
  • 2,455
29

This worked for me

bind -f ~/.inputrc

https://unix.stackexchange.com/questions/153357/inputrc-file-not-sourcing-correctly/246422#246422

rofrol
  • 2,001
  • 19
  • 17
14

In .inputrc first choose your binding and after bind the re-read-init-file function:

set editing-mode vi
"\C-x\C-r": re-read-init-file

Press CTRL and x, release both, press CTRL and r.

2

This worked for me:

exec $SHELL

This runs the current shell again, without creating a subprocess, and it involves doing all the usual initialisations and script reading, so any new or changed settings in /etc/inputrc, ~/.profile, ~/.bashrc etc. become effective.

Toto
  • 19,304
1

The following snippet for ~/.inputrc will map C-x C-r in all keymaps (emacs, vim command mode and vim insert mode):

set keymap emacs
"\C-x\C-r": re-read-init-file

set keymap vi-command "\C-x\C-r": re-read-init-file

set keymap vi-insert "\C-x\C-r": re-read-init-file

thiagowfx
  • 1,808