I want to set a key binding in bash for "history-search-backward" readline command to a combination of Control+some other key (I'm using 2 as an example), but I'm unable to do so.
(edit: it seems the problem was my choice of 2 as the example key. I tried with \C-l and it's working. I'll still accept an answer if someone explains why 2 doesn't work)
After several tries my ~/.inputrc now looks like this
set bind-tty-special-chars off "\C-2": history-search-backward
but it doesn't work and bind -p | grep "-2" gives nothing. If I try something without the control key, it works:
I can search in the history by prssing the sequence C + - + 2.
bind -p gives control in \C form, for example:
I've tried different formats in my inputrc:
Control-2: history-search-backward Ctrl-2: history-search-backward "Control-2": history-search-backward
but nothing works.
works if I press Escape followed by 2.
Can anyone help?
Bash version 4.0.23(1)
GNU Readline 5.2 (according to the man page)