On my command line in Ubuntu Server 16.04.1 , I would like to bind Ctrlup/down to the bash history incremental search function. I found some posts how to do it. They involve the ~/.bashrc
and ~/.inputrc
files.
Strange characters appearing when I use the Ctrl and Arrow keys to navigate says this works via the .inputrc
file in the home directory. Why does ctrl + left arrow not skip words? contains comments about not using .inputrc
, about using .zshrc
and using .bashrc
. I am still too new to not be confused.
I did not have any .inputrc
in my fresh server install.
I do not understand those things:
- is .inputrc the right place to put in key bindings in 16.04?
- Is that the same for all different flavours als older version of ubunutu?
- it is normal to have no .inputrc file in my home directory?
- What is recommended : copy the /etc/input to home and edit or make a link in a new .inputrc and edit the file in etc?
I did not get it to work, too. I tried both copying the file from etc
and rename it to .inputrc
and also creating a new file in ~/
with:
touch .inputrc
nano .inputrc
The file content:
$include /etc/inputrc
Here is the what I put into the files.
# mappings for Ctrl-left-arrow and Ctrl-right-arrow for word moving
"\e[1;5C": forward-word
"\e[1;5D": backward-word
"\e[5C": forward-word
"\e[5D": backward-word
"\e\e[C": forward-word
"\e\e[D": backward-word
# ctrl up,down
"\e\e[A": history-search-backward
"\e\e[B": history-search-forward
Both do not work, Ctrl key is ignored. CTRLUp/down do not show the search and CTRLleft/right do not skip words. I think it matches the answer of the seconds post.
What could be the problem?