Change setting of arrow keys for history in BASH (Fedora Core 2 Wishlist)

Jaap A. Haitsma jaap at haitsma.org
Sat Dec 13 12:48:32 UTC 2003


Hi,

Standard the up arrow and the down arrow are bound to "previous-history" 
and "next-history" respectively.

I changed these to "history-search-backward" and 
"history-search-forward" respectively by adding the following to lines 
to /etc/inputrc

"\M-[A":history-search-backward
"\M-[B":history-search-forward

If you have not typed anything on the prompt and use the arrow keys the 
behaviour is identical to the behaviour of "previous-history" and 
"next-history".

However if you type something (a beginning of a command) and then use 
the arrow keys it will search backward or forward in the history trying 
to find a command of which the first charaters match to the ones your 
type. This is a very powerful feature.

To demonstrate it here's an example
For example I use cvs over the internet quite a bit. To login I have to 
type something like "cvs -d :pserver:jaap at haitsma.org/cvs login" Now on 
the next day I want to login again with the proposed feature enabled I 
only type cvs -d and then the up arrow.

Really cool thing of this is that the normal behaviour of the arrow keys 
does not change while you get a very powerful feature

Jaap





More information about the fedora-devel-list mailing list