When ~/.inputrc
does not exist, hitting Ctrl+Left Arrow and Ctrl+Right Arrow on a Bash command line moves the cursor back and forward by one word, respectively.
However, if ~/.inputrc
exists (regardless of whether or not it's empty), those two key combos result in ;5D
and ;5C
being printed where the cursor is instead of moving the cursor.
How can I fix that?
Best Answer
Its because if the file exists, bash uses your local settings for the readline settings instead of the default one.
From http://www.gnu.org/software/bash/manual/html_node/Readline-Init-File.html
The recommendation in the sample file at gnu.org is to source the default in your local one with a line like this:
and then modify from there.