How to forward-search-history with the reverse-i-search command (ctrl+r)?
Solution 1:
The sequence C-s
is taken from the terminal driver, as you can see from
stty -a | grep '\^S'
To free up the sequence for use by readline, set the stop terminal sequence to some other sequence, as for example
stty stop ^J
or remove it altogether with
stty stop undef
After that C-s
would work in the given terminal.
Set it in ~/.bashrc
to make it work in every terminal.
The M-
sequence means the Alt key, as already noted.
Solution 2:
In addition to assigning a different TTY 'stop' char as suggested above, you can remove it entirely if you don't plan to use it (I tend not to), like this:
$ stty stop undef
Then readline can use control-s for forward search and you won't get any strange behavior due to a new stop char being added.
Solution 3:
forward-search-history (C-s) doesn't work (though it is in the man page).
'M-' represents the Alt key modifier.